I am trying to use the server-side validation in chrononforms to ensure that the "access code" entered equals 1 of multiple possibilities. Then, based on what access code they enter, re-direct them to specific urls based on the access code entered. I know it is possible, just wondering if anyone has some advice??
My access code is going into field name regcode_1 . If the access code doesn't match, I want it to just display my "You have entered an invalid access code, please check your code and try again."
Thanks for any help.
JS
My access code is going into field name regcode_1 . If the access code doesn't match, I want it to just display my "You have entered an invalid access code, please check your code and try again."
Thanks for any help.
JS
Hi coachsutton,
Cheers
Max
if(JRequest::getVar('regcode_1') != 'DAASDSADSAFDSREWDFSADF'){
return "You have entered an invalid access code, please check your code and try again.";
}
Cheers
Max
Thanks Max, a few more questions...
In this code, how do you tell it to check if it matches MULTIPLE possibilities. Ex. access1, access2, and access3 are all valid codes. (I guess I don't know how to separate multiple values in this code)
Second question, once that works, how do I redirect to different pages based on the access code entereD?(currently all "validated" traffic goes to the re-direct URL set in Chronoforms)
Thanks.
In this code, how do you tell it to check if it matches MULTIPLE possibilities. Ex. access1, access2, and access3 are all valid codes. (I guess I don't know how to separate multiple values in this code)
Second question, once that works, how do I redirect to different pages based on the access code entereD?(currently all "validated" traffic goes to the re-direct URL set in Chronoforms)
Thanks.
Hi,
below is a multi check
you can use almost the same code with few changes in the onsubmit box to different redirection:
Cheers
Max
below is a multi check
if((JRequest::getVar('regcode_1') != 'REWDFSADF')&&(JRequest::getVar('regcode_1') != '2REWDFSADF')&&(JRequest::getVar('regcode_1') != '3REWDFSADF')){
return "You have entered an invalid access code, please check your code and try again.";
}
you can use almost the same code with few changes in the onsubmit box to different redirection:
if(JRequest::getVar('regcode_1') != 'DAASDSADSAFDSREWDFSADF'){
$MyForm->setFormData('redirecturl', 'http://something here');
}
if(JRequest::getVar('regcode_1') != 'SADF'){
$MyForm->setFormData('redirecturl', 'http://something here');
}
.
.
.
.
Cheers
Max
This topic is locked and no more replies can be posted.
