Hello again!
I want to add field where user can enter code sent by SMS. But it troubles me where do i put the checker code, so if it's wrong, to return error message?
the code is
Thanks!
I want to add field where user can enter code sent by SMS. But it troubles me where do i put the checker code, so if it's wrong, to return error message?
the code is
<?PHP
function mobio_checkcode($servID, $code, $debug=0) {
$ret = 0;
$mobio_socket = fsockopen("www.mobio.bg", 80);
if(!$mobio_socket) {
if($debug)
echo "Unable to connect to mobio.bg server\n";
$ret = 0;
}else{
$request .= "GET http://www.mobio.bg/code/checkcode.php?servID=$servID&code=$code HTTP/1.0\r\n\r\n";
fwrite($mobio_socket, $request);
$result = fread($mobio_socket, 255);
if(strstr($result, "PAYBG=OK")) {
$ret = 1;
}else{
$ret = 0;
if($debug)
echo strstr($result, "PAYBG");
}
fclose($mobio_socket);
}
return $ret;
}
$servID = 16;
$code = $_REQUEST["code"];
if(mobio_checkcode($servID, $code, 1) == 1) {
echo "Valid code";
}else{
echo "Invalid code";
}
?>
Thanks!
Hi vbarlakoski,
Ths look like a case to use Ajax to check the code when the user types it in. Alterantively you can use it in he Server side validation after the form is submitted.
Bob
Ths look like a case to use Ajax to check the code when the user types it in. Alterantively you can use it in he Server side validation after the form is submitted.
Bob
Yup, i was thinking about checking after submit, like captcha code does. But,
can you help me where to put the validation code, and how should i connect with the field?
can you help me where to put the validation code, and how should i connect with the field?
Hi vbarlakoski,
Which version of ChronoForms are you using? You can find the version from Site Admin | Extensions | Install/Uninstall | Components in Joomla! 1.5 or Site Admin | Extensions | Extension Manager | Manage in Joomla! 1.6/1.7/2.5.
Bob
Which version of ChronoForms are you using? You can find the version from Site Admin | Extensions | Install/Uninstall | Components in Joomla! 1.5 or Site Admin | Extensions | Extension Manager | Manage in Joomla! 1.6/1.7/2.5.
Bob
Hello!
Its 4.0 RC3.11 Joomla 2.5.
Its 4.0 RC3.11 Joomla 2.5.
Hi vbarlakoski ,
Thank - then you can use the Custom Serverside Validation action in the On Submit event to run the check.
There's a new release CFv4 RC4 that you should upgrafd to as it has some bug-fixes as well as new features.
Bob
Thank - then you can use the Custom Serverside Validation action in the On Submit event to run the check.
There's a new release CFv4 RC4 that you should upgrafd to as it has some bug-fixes as well as new features.
Bob
Thanks Bob!
I`ll check it. Just one more question, because the SMS code field is not required (if you fill it, you`ll get extra options, if you not, you have basic options) how can i set, if the field is filled up, then check after submit. Or there is no other way?
I`ll check it. Just one more question, because the SMS code field is not required (if you fill it, you`ll get extra options, if you not, you have basic options) how can i set, if the field is filled up, then check after submit. Or there is no other way?
I`ll try to be more clear🙂
SMS code field is not REQUIRED, so i want to check it only if its filled up.
How can i finish it?
Thanks!
SMS code field is not REQUIRED, so i want to check it only if its filled up.
How can i finish it?
Thanks!
Hi vbarlakoski,
In the Serverside validation check if there is an entry in the form data. Assuming that the input is named sms_code:
Bob
In the Serverside validation check if there is an entry in the form data. Assuming that the input is named sms_code:
<?php
if ( !isset($form->data['sms_code']) && $form->data['sms_code'] ) {
// run the check code
}
?>
Bob
Super duper!
I will let you know if it works!
I will let you know if it works!
Hello Bob!
This is the actual code for field checking thats work!
So, thanks🙂 It Works!
<?php
if ( (isset($form->data['input_text_21'])) && ($form->data['input_text_21'] != '')) {
// run the check code
}
?>
This is the actual code for field checking thats work!
So, thanks🙂 It Works!
This topic is locked and no more replies can be posted.