Query database before "final" submit
Query database before "final" submit

Hi,
I have a table (step) that contains several "modules" (one for source, one for destination).
The user can select those modules for each step - but he just has a maximum number of module-types.
I want to perform a check (on initSubmit ?) that he did not change/add a module that exceeds the maximum number for that module-type.
Is there a way to get these information from the database on an (presubmit) event and - in case of exceeding the number - roll-back
to the original values before the change (which I could save in a local) - or just refuse the creation of this new step?
Thanks a lot for some hints,
Pascal
Replies
Hi @rheinertp ,
That's possible - if you look at the final example on
initSubmit
, it's issuing an ajax call to validate a user - you could have code similar to that. The rollback wouldn't happen, the user would have to cancel the edit, but as you say, you could set the value back withset()
to what it was when the form was opened (initEdit
).Hope that helps,
Cheers,
Colin
Hi colin,
that seems to be the right starting point - BUT there seems to be something missing:
The data-array is not given to the PHP-function ...
Problem is that $stepi = $post['stepid'] is always empty ... the function does get any _POST parameter...
What is wrong with it?
Thanks,
Pascal
Sorry!!!
I solved it - not using the data function (d) - but by setting the values like this: