Form works on edit but not on add

Status
Not open for further replies.

jfquestiaux

Well-Known Member
I have a complex (for me) form with 3 CDD's that I finally got working, at least partially:

If I edit an existing record, the form works as expected: each CDD is triggered the way it should and the correct values are displayed in the dropdowns.

But if I want to add a new record, I get this error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '}) ORDER BY text ASC' at line 3 SQL=SELECT DISTINCT(`manufacturers`.`id`) AS value, `manufacturers`.`name`AS text FROM `manufacturers` AS `manufacturers` WHERE manufacturers.id IN (select manufacturer_id from equipment_manufacturer where type_id = {equipment___type_id_raw}) ORDER BY text ASC

The problem seems to be that, in an empty form, '{equipment___type_id_raw}' is empty, thus causing an error.

This form is essential in this application. Any idea how to fix this? I am stuck here now.
 
Where is '{equipment___type_id_raw} coming from? I think it is not empty but not known in new records (so displaying the litterary string)
Did you set a default?


Gesendet mit Tapatalk
 
I would guess its from a custom where query you added to a cdd or db join element, in which case you should encase it in quotes - so:

WHERE manufacturers.id IN (select manufacturer_id from equipment_manufacturer where type_id = '{equipment___type_id_raw}')
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top