| Jim Hidson. |
| When using XML Connectors dropdown to (grandparent–parent-child relationship for Company – Office – Address), the first XML Connector is defaulting to the first available option, then not loading the child options (and grandchildren). Can we default this Yes ,by using JS script. - Click on the Company XML Connector control and open the rules manager dialog.
- You should have a ready created rule called QueryRule3, click on it:

- Update the action script to be like this:

The new script will be like this: function addBlankSelection(){ var select = document.getElementById('XML_Company'); var option = document.createElement('option'); option.text = option.value = 'Select a Company...'; select.add(option, 0); select.selectedIndex = 0; } executeXMLQuery(XML_Company, addBlankSelection); Create a function to be called synchronously, because XML connectors load data asynchronously to speed up loading forms. This way you will have the function executed after loading the XML data being populated in the dropdown list and the new value will be posted at index 0. Note: Save this script somewhere as it might get reset if you changed the type of the XML or the “Execute on” properties in the control’s settings dialog. Of course you could always get back the old configuaration if you restored the form from the form’s history.
|
Jim Hidson.-, -
| /_layouts/15/images/person.gif" alt="Picture Placeholder: Jim Hidson." /> | Jim Hidson. |
| Yes ,by using JS script. - Click on the Company XML Connector control and open the rules manager dialog.
- You should have a ready created rule called QueryRule3, click on it:

- Update the action script to be like this:

The new script will be like this: function addBlankSelection(){ var select = document.getElementById('XML_Company'); var option = document.createElement('option'); option.text = option.value = 'Select a Company...'; select.add(option, 0); select.selectedIndex = 0; } executeXMLQuery(XML_Company, addBlankSelection); Create a function to be called synchronously, because XML connectors load data asynchronously to speed up loading forms. This way you will have the function executed after loading the XML data being populated in the dropdown list and the new value will be posted at index 0. Note: Save this script somewhere as it might get reset if you changed the type of the XML or the “Execute on” properties in the control’s settings dialog. Of course you could always get back the old configuaration if you restored the form from the form’s history.
| | | | | 0 | 2/23/2022 5:08 AM | 2/23/2022 5:47 AM | No | Codes & Scripts | 0 | | | 12/2/2021 4:19 AM | | | |