Hi,
I need you help.
My customer want's as security function in his form a calculation instead of the captchas.
For example the user have to enter the result of 4+5. When he enters the right result the form will be OK, otherwise he will get a message - "Wrong result ...".
Is there a function to integrate something like that?
If there isn't any function, I thought about including a simple textfield with a message: "Solve this calculation: 7+3!...". The user have to write the result in the textfield. When the input is right, the form will be OK, when not - he will get an error message. But how can I check this field for the right input?
I hofe you can help me ...
I need you help.
My customer want's as security function in his form a calculation instead of the captchas.
For example the user have to enter the result of 4+5. When he enters the right result the form will be OK, otherwise he will get a message - "Wrong result ...".
Is there a function to integrate something like that?
If there isn't any function, I thought about including a simple textfield with a message: "Solve this calculation: 7+3!...". The user have to write the result in the textfield. When the input is right, the form will be OK, when not - he will get an error message. But how can I check this field for the right input?
I hofe you can help me ...
Hi fomlackner,
There's nothing built in but it's not hard to create code to do this using a Custom Code element. Best to use ServerSide validation to check the result.
Bob
There's nothing built in but it's not hard to create code to do this using a Custom Code element. Best to use ServerSide validation to check the result.
Bob
Hi, thanks for the answer.
Now I'm near to the solution I think.
I have entered the following code into "Custom Server Side Validation":
But this goes totally wrong - chrono forms does nothing. Not even the onfail thing.
Why that?
Now I'm near to the solution I think.
I have entered the following code into "Custom Server Side Validation":
<?php
if ( $form->data['calculation'] == '11' ) {
$message = right;
} else {
$error_count++;
}
if ( $error_count ) {
return false;
}
?>
But this goes totally wrong - chrono forms does nothing. Not even the onfail thing.
Why that?
Hi fomlacker,
I'm not quite sure what is happening to the $error_count here; it may need setting to 0 to start with.
Please try:
Bob
.
I'm not quite sure what is happening to the $error_count here; it may need setting to 0 to start with.
Please try:
<?php
if ( $form->data['calculation'] != '11' ) {
$form->validation_errors['calculation'] = "Please try again.";
return false;
}
?>
Bob
.
Hi Bob,
thx ... now it works! Perfect!
thx ... now it works! Perfect!
Hey,
In my form, I have added the following code to check that the field_id = "comment" is less 1000 characters. However, when I add content with greater than 1000 chars, the Custom Server Side Validation is not showing an error and the email is still sent:
My email actions in the onSubmit area are in the following order:
Check Captcha
Upload Files
Custom Server Side Validation
Using J1.6.6 and Chronoforms_J1.6_V4_RC1.9
In my form, I have added the following code to check that the field_id = "comment" is less 1000 characters. However, when I add content with greater than 1000 chars, the Custom Server Side Validation is not showing an error and the email is still sent:
<?php
if (strlen($form->data['comment']) > 1000) {
$form->validation_errors['comment'] = "Your message is too long. If this is intentional, please send management an attachment.";
$error_count++;
return false;
}
?>
My email actions in the onSubmit area are in the following order:
Check Captcha
Upload Files
Custom Server Side Validation
Using J1.6.6 and Chronoforms_J1.6_V4_RC1.9
This topic is locked and no more replies can be posted.