Good morning, I'm using cf v4 and I can't find where to insert my php code for server-side validation... where is that area?
Thanks,
Francesco
Hi Francesco,
Drag a Custom ServerSide action into the On Submit event.
Bob
Ok, but if I've already created my forms? I must insert that functions when I create it or is there the possibility to do that in a second moment?
Thanks,
Francesco
Hi Franceso,
Click the Wizard Edit link and you can do it now.
Bob
In my wizard edit I can't see the actions tab so it isn't the events tab... :?
ok, i've found...i was in the easy mode 😫
Tnx =)
i've been making attempts for 2 hours...i've inserted my functions for server side validations but it's as they are not... I can't understand why. The php code seems to be good but that functions are never called.
I have drag the "custom server side validation" in the onSubmit area, then I have moved it in the top, in 2nd position, after the "check captcha" cause in my opinion this validation should be done after the check captcha. I have changed only an option of captcha on fail: Quit next actions -> no.
Have you got any idea of why doesn't work? 😶
Hi Francesco,
No idea :-( By all means email or PM me the site URL and a SuperAdmin login and I'll take a quick look.
Bob
Hi Francesco,
I have changed only an option of captcha on fail: Quit next actions -> no.
This is in the "Event loop" ? please set it back to yes or it will continue with the form processing even if captcha fails.
Did you add an event loop in the "server side validation" on fail as well ?
Where is your server side PHP code ? does it return Boolean "false" on fail ?
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Hi Francesco,
The first form now has working Server Side validation. There were two problems that I saw. There wasn't an Event Loop action in the On Fail box and the code in the Validation box was the old CFv3 format that doesn't work in CFv4.
To fail the box must return 'false' and you also can add messages to the $form->validation_errors array. Please check the code now in the box (and the Help tab) for more info.
Bob
thanks very much!! I'm going to disable your account =)
only another question..now the server side error message is pink and is shown in a standard position, if I would customize that ( in most site pages I have 2 forms...i think this is a useful information).
Hi Francesco,
There is a 'Show Top Errors' option in the Form General tab (click the Name link in the Forms Manager to access it). I'm not sure what happens if you set it to 'No' though, please let us know.
Bob
I've tried.. if I check that item the result is that the error message is not shown but the data in the form are not lost. You can correct the error (but you have to understand by yourself which) and then submit.
That's not so good... I think that the message is useful for the user..
if you want to try go to my home page and try the first form (insert two telephone number not equal). <!-- w --><a class="postlink" href="http://www.golflife.it">www.golflife.it</a><!-- w -->
Hi Franceso,
I think that if you add a message div to your form HTML like [code]<div id="error-message-email"></div>/code]Then the error message will display inside the div. (Replace 'email' with the name of the input the message refers to.)
Bob
I've tried your code and it seems to be ok... only one thing... when I correct the errors and do submit, I continue to see the form with the data (correct) except the ones that it erase automatically like select and checkbox.. but it's not shown the thanks message.. depend on something like event loop or similar? 🙄
Hi Franceso,
ChronoForms will republish Select and Checkboxes if it can recognise them. You are using Custom HTML so you may need to tweak it a bit to get this to work.
For the Thank you page - impossible to tell without seeing how you have the form set up.
Bob
The problem is not that CF doesn't keep that data...I said to explain you the situation.. the problem is that after I correct the error (server-side) and click on submit button again, it d0n't continue to go to the next step (thank you message - add data in the table) but I continue to see the form with the data i just inserted in.
I hope you understand =)
Thanks
Hi Francesco,
That sounds as though there may be a problem with the sequence of actions and events. Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.
Bob
ok, here is the zip of the forms backup.. The one we are speaking is the first.formHome.
Thanks a lot,
francesco
Hi Franceso,
Could be that you have a validation check for cognome but there is no cognome input?? So the form will always fail the validation and there is no span to display the error message so you see nothing.
Bob
ok, now it seems to work.. there was an error in the php code, the regular expression. If I should try any other question i'll write to you =)
Thanks a lot!