Subpanels - Main module and subpanel name field share the same ID

Hi, I’m working on having a name of a record get auto-filled based on the parent record and noticed something which is weird but I guess makes sense by design. I have subpanels working on my editview and when I take a look at the html it specifies the name field of the main record and the name field of the subpanel record under the same ID. Not sure if there’s anything I can do there other than changing the label and doing a :contains() in jQuery, but thought that might lead to issues because even if I didn’t have subpanels working on editview this same cross-contamination would occur on detailview.

@lucid
I don’t sure that understand your correctly. But if you want to get parent data when push on “QuickCreate” button you can make custom code for the button.

  • Look at file:
    include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php
  • You can make custom file:
    custom/include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate<your_name>.php
  • And call it in child module:
    custom/modules/Accounts/metadata/subpanels/default.php
    or parent module (higher priority):
    custom/modules/Accounts/metadata/subpaneldefs.php
    in array top_buttons.

It wasn’t necessarily a question on how to do it, just wanted to point out that input fields had id’s that equaled others. Seems like something that could end up breaking