Incremental
Member
Hi,
in a PHP validation element, I use the following code :
I have a naughty bug at validation.
After loading the form, each time I save the form with a correct ID, the $found trace is 1 and the validation is True.
If I set a not existing ID, $found is null and the validation is False.
Until now, everything is OK, BUT if I set again an existing ID, $found = 1 and the validation is always False.
If I refresh the form it works again.
It's like if validation is False, it could never become again True.
Please help, I get crazy since 2 days !!!
Thanks
in a PHP validation element, I use the following code :
Code:
// Check if ID exists
//===================
// Get the form field's value :
$IDinput = (int) $formModel->_formData['contacts___ContactsFormID'];
//dump($IDinput, "Form ID");
// Get the db object
$db =JFactory::getDbo();
// Quote the values for security reasons
$IDinput = $db->quote($IDinput);
// Build the query
$query = $db->getQuery(true);
$query = "SELECT count(*) FROM ContactsParams WHERE ID=" . $IDinput;
$db->setQuery($query);
//dump($query, "Query");
// Run the query
$found = (int) $db->LoadResult();
dump($found, "found");
return ($found != 0);
I have a naughty bug at validation.
After loading the form, each time I save the form with a correct ID, the $found trace is 1 and the validation is True.
If I set a not existing ID, $found is null and the validation is False.
Until now, everything is OK, BUT if I set again an existing ID, $found = 1 and the validation is always False.
If I refresh the form it works again.
It's like if validation is False, it could never become again True.
Please help, I get crazy since 2 days !!!
Thanks