im trying to make a dropdown box, from my table (#__projectinfo) where I can choose e.g a article and show him in a editor ready to use, update or save.
The objective is to choose a email body and send it to a user, the select box is to choose the email, but i need the ready to use editor
e.g: http://prntscr.com/jctkrb , like a article editor (see the image)
any question fell free to ask, ty :D
You can use sql field of jform to show list of article from your table(#__projectinfo) , You could use something below in your your_form.xml file.
<field name="myProjectList"
type="sql"
default="10"
label="Select an article"
query="SELECT id, title FROM #__projectinfo"
key_field="id" // Use your respected key_field column
value_field="title" //Use your respected value_field column
/>
Also you will need the editor field in xml to show the article selected.
After this catch event of javasript for the given field e.g onChange
Get the value of myProjectList field using getElementById()
Send the ajax call to fetch the selected id's data
Then use setText() method on success of ajax to set the info to editor field