0

I developed a plugin for Joomla!, and I have the below sql parameter field in my sampleplugin.xml

<field
    name="cb_fields"
    type="sql"
    label="Select CB fields"
    query="SELECT name FROM #__comprofiler_fields WHERE `table`= '#__comprofiler' AND `published`='1' AND `type`='text'"
    key_field="name"
    value_field="name"
    multiple="multiple" />

I got sql error because the CB is not installed on a client's website. The problem is how to check if the table #__comprofiler_fields exists first before getting data from there ?

Thank you.

0

Create a custom form field type. From SQL form field type documentation:

Warning!

Using this generic form field type forces you to write SQL in an XML file and is rather limited. For more flexibility, consider creating your own, specific form field type by subclassing the JFormField class.

https://docs.joomla.org/SQL_form_field_type

https://docs.joomla.org/Creating_a_custom_form_field_type

  • How to define a custom form field type inside the plugin xml file ? – ahmad Dec 16 '18 at 15:11
  • From Creating a custom form field type documentation: Using the custom field type > To use the field type City, we need to update the XML file that contains the form fields. Open your XML file located in administrator/components/com_phonebook/models/forms and add the field in the usual way... @sharky – ahmad Dec 16 '18 at 15:17

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.