Have only the bear minimum to start testing:Field "p1" exist in the form.When the form submit is requested the form is not shown again nor the error is displayed.What could be wrong here?"> Server Side Validation - Forums

Forums

Server Side Validation

rodiusd 24 Sep, 2013
[attachment=0]ChronoForm01.zip[/attachment]Hi,

got a form working and want to add some validation.

My onSubmit is confirated as follows (see attachment):
On Submit
Customer Server Side validation (chkTeamResults.php)
OnSuccess
Custom Code (putTeamResults.php)
OnFail
Event Loop (with default settings)

chkTeamResults.php
<?php
$form->validation_errors['p1'] = "test error";
return false;
?>


Have only the bear minimum to start testing:
Field "p1" exist in the form.

When the form submit is requested the form is not shown again nor the error is displayed.

What could be wrong here?
GreyHead 24 Sep, 2013
Hi rodiusd,

Are you trying to include the code for the Serverside validation? Does it work if you put the code directly into the action Code box?

Hard to say much from the information here :-(

Bob

PS I generally advise against using the On Success events unless there is not alternative. Put those actions in the main On Submit event after the SS Validation action.
rodiusd 25 Sep, 2013
Hi Bob,

yes i Include the validation code as its a lot of checks.

If i put this directly after the SS Valaidation, how can i check then if the validation has no errors so that i can go along or should re-display my form?
rodiusd 25 Sep, 2013
Hi Bob,

got it working for a form with fixed fields. Had to put in the "session to data" in the onLoad event and "data to session" in the onSubmit event before my checks.

However the form where i need it, is a form with dynamic fields, like an order form (adding each line by a button).
How can i find out that this form is redisplayed with errors so that i can, maybe run a js function, to display the relevant fields already on the form when the submit was executed.

I don't see a way, so maybe you have an idea.
GreyHead 28 Sep, 2013
Hi rodiusd,

You have to add a chunk of code that checks the values when the page is re-loaded and hides or un-hides the corresponding elements. Whether that is JavaScript or PHP depends on how you are creating the 'Add One' elements.

Bob
rodiusd 29 Sep, 2013
Hi Bob,

thanks, i'm on the way to extend my JS to check if there are errors:

When the page is re-displayed due to errors then i have the follow html code:
<span class="cf_alert">
<ol>
</span>

This html code don't exist in an errorless formpage.
So i can decides which fields should be displayed again, this without checking for data in it.
This topic is locked and no more replies can be posted.