I would like to populate the "Owner" select option list by SELECTing the
owner column from the
#__gscrm_accounts table WHERE the
gscrm_account_id (primary key) is the selected "Person or Business" value.
This ajax needs to be triggered by the
onchange() event of
<field name="account"> then populate
To be clear, I don't know if this is "fresh" or "modified" copy of SimpleCRM because I've never used SimpleCRM and this project was just thrown at me.
In components/com_gscrm/View/Notes/tmpl/form.form.xml, the "Person or Business" select field is generated from:
<field name="account" class="high28" labelclass="label_left" label_placement="top" label="COM_GSCRM_NOTES_ACCOUNT_LABEL" tooltip="COM_GSCRM_NOTES_ACCOUNT_DESC" type="Model" model="Accounts" key_field="gscrm_account_id" value_field="title" apply_access="true" apply_enabled="true" none="GS_SELECT" > <state key="code">[ITEM:CODE]</state> </field>
The "Owner of this contact" field is generated by:
<field name="owner" emptylabel="1" class="high28" labelclass="label_left" label_placement="top" label="COM_GSCRM_NOTES_OWNER_LABEL" type="Model" model="Beads" key_field="gscrm_bead_id" value_field="user_name" apply_access="true" apply_enabled="true" none="GS_NOT_AVAILABLE" > <state key="code">[ITEM:CODE]</state> </field>
I know that I will need to add a bit of complexity to the query that I actually require and it might not be a single "owner" value that I am returning, but my question is: How do I execute the ajax process using best practices and pre-existing classes/methods if possible?
I had a look at https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_AJAX but that isn't specifically dealing with
This looks close: How to change select list from another using AJAX in Joomla but I am not sure about the best placement of the files and I am not dealing with chozen elements.
Soren's answer indicates that I should be crafting a url like:
If so, where do I best park my
Loading the options of a select form field via jQuery Ajax looks similar, but mostly yatta-yattas over the fundamental pieces that I require:
All of the posts have a fair bit of age on them and I expect to see a token used in this process.