SQL Field - Bug in XML Form Compiler? #14

Closed
opened 2016-07-16 23:49:09 +00:00 by paolavness · 4 comments
paolavness commented 2016-07-16 23:49:09 +00:00 (Migrated from github.com)

Hello Again,

So I'm wondering if this is a bug in the system or if there is something I am missing.

I've used CB to create a field called 'Countries' which does a lookup in a 'countries' table (installed with the component as a SQL Script, NOT via an admin view). The field is being used in an admin view called 'Contacts'. The component compiles and installs fine, lists contacts fine, but when I try adding an new contact, a parse error is thrown - the contacts.xml form file generated by CB contains an error...

I've looked up the line of code and debugged. Below is the XML generated for this specific field:

<!-- Country Field. Type: Sql. (joomla) -->
<field
    type="sql"
    name="country"
    label="COM_MYCOMPONENT_CONTACT_COUNTRY_LABEL"
    query="SELECT id as value, country FROM #__mycomponent_countries"
    <!-- No Manual Options Were Added In Field Settings. -->
/>

I've got it working by deleting the line
<!-- No Manual Options Were Added In Field Settings. -->

IE, the below works fine, without throwing errors, and saves contacts:

<!-- Country Field. Type: Sql. (joomla) -->
<field
    type="sql"
    name="country"
    label="COM_MYCOMPONENT_CONTACT_COUNTRY_LABEL"
    query="SELECT id as value, country FROM #__mycomponent_countries"
/>

So am I missing something that the compiler throw this line in, or is it a bug?

Thanks,
Paola

Hello Again, So I'm wondering if this is a bug in the system or if there is something I am missing. I've used CB to create a field called 'Countries' which does a lookup in a 'countries' table (installed with the component as a SQL Script, NOT via an admin view). The field is being used in an admin view called 'Contacts'. The component compiles and installs fine, lists contacts fine, but when I try adding an new contact, a parse error is thrown - the contacts.xml form file generated by CB contains an error... I've looked up the line of code and debugged. Below is the XML generated for this specific field: ``` <!-- Country Field. Type: Sql. (joomla) --> <field type="sql" name="country" label="COM_MYCOMPONENT_CONTACT_COUNTRY_LABEL" query="SELECT id as value, country FROM #__mycomponent_countries" <!-- No Manual Options Were Added In Field Settings. --> /> ``` I've got it working by deleting the line `<!-- No Manual Options Were Added In Field Settings. -->` IE, the below works fine, without throwing errors, and saves contacts: ``` <!-- Country Field. Type: Sql. (joomla) --> <field type="sql" name="country" label="COM_MYCOMPONENT_CONTACT_COUNTRY_LABEL" query="SELECT id as value, country FROM #__mycomponent_countries" /> ``` So am I missing something that the compiler throw this line in, or is it a bug? Thanks, Paola

Wow Paola

IT seems you are right, this is a bug... I will fix it and get back to you.

Wow Paola IT seems you are right, this is a bug... I will fix it and get back to you.

The line that adds that string can be found here https://github.com/vdm-io/Joomla-Component-Builder/blob/master/admin/helpers/compiler/c_Fields.php#L859

The SQL field is part of the options group, since it is a list field. But since you don't add options the CB-tool thinks you made a mistake and adds this line... so I will add a check to insure that it will ignore the SQL field.

The line that adds that string can be found here https://github.com/vdm-io/Joomla-Component-Builder/blob/master/admin/helpers/compiler/c_Fields.php#L859 The SQL field is part of the options group, since it is a list field. But since you don't add options the CB-tool thinks you made a mistake and adds this line... so I will add a check to insure that it will ignore the SQL field.

Let me know if this fix worked for you.

Let me know if this fix worked for you.
paolavness commented 2016-07-17 17:51:52 +00:00 (Migrated from github.com)

That's great, thank-you for the quick fix! And the sermons too, also working - its a great example for the more complex goodies I'm doing.
Thoroughly appreciate the quick turn around here Llewellyn. My timeline is tight and this is hugely supportive.
Warmly,
Paola

That's great, thank-you for the quick fix! And the sermons too, also working - its a great example for the more complex goodies I'm doing. Thoroughly appreciate the quick turn around here Llewellyn. My timeline is tight and this is hugely supportive. Warmly, Paola
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#14
No description provided.