how to do php form validation on save?

p38

Active Member
Hi,

Is there any way to do php validation when the SAVE button is pressed, and if it fails, it must revert back to the editing form?

I want to do advanceed PHP checking when a SAVE is issued, and if fails, I want to continue editing?

I know there is a php plugin, but I cant figure out how to revert back to the editing form. There is also teh conformation plugin, but this only asks a question.

Paul
 
You can use the php plugin onBeforeSave and I think add dome error messages and return false. See the php plugin WIKI

gesendet mit Tapatalk
 
thank you, was not aware that if you explicitly return false to onBeforeProcess, it stops the form submission, as I always use it to process php code, so never return true or false.

Code:
$formModel->errors['tablename___elementname'][] = 'woops!';
return false;
 
Yup. Likewise onBeforeStore. The only difference there being that onBeforeStore happens after uploading any files.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top