Hi forum users!
I have a form where some fields are required, dependent on a dropdown i disable these fields.
These fields are in a <div> container.
But when I submit the form and get the email, the disabled field inputs are not empty, but have brackets like {input_4}.
How can i prevent this behavior?
This is my code..
I read something about "addClass("validate['required']") and formcheck.register" but i dont know how to implement?!
please can somebody help me with this?
I have a form where some fields are required, dependent on a dropdown i disable these fields.
These fields are in a <div> container.
But when I submit the form and get the email, the disabled field inputs are not empty, but have brackets like {input_4}.
How can i prevent this behavior?
This is my code..
window.addEvent('domready', function() {
var myVerticalSlide = new Fx.Slide('adresse');
var mySonstigeSlide = new Fx.Slide('sonstige_container_div');
$('anliegen').addEvent('change', function() {
if ($('anliegen').value == 'Bestellung' || $('anliegen').value == 'Versand' ) {
$$('#adresse input').each(function(item){
item.disabled = false; });
myVerticalSlide.slideIn();
} else {
$$('#adresse input').each(function(item){
item.disabled = true; });
myVerticalSlide.slideOut();
}
if ($('anliegen').value == 'Sonstige Fragen') {
$('sonstige').disabled = false;
mySonstigeSlide.slideIn();
} else {
$('sonstige').disabled = true;
mySonstigeSlide.slideOut();
}
});
if ($('anliegen').value == 'Bestellung' || $('anliegen').value == 'Versand' ) {
$$('#adresse input').each(function(item){
item.disabled = false; });
myVerticalSlide.show();
} else {
$$('#adresse input').each(function(item){
item.disabled = true; });
myVerticalSlide.hide();
}
if ($('anliegen').value == 'Sonstige Fragen') {
$('sonstige').disabled = false;
mySonstigeSlide.show();
} else{
$('sonstige').disabled = true;
mySonstigeSlide.hide();
}
});
I read something about "addClass("validate['required']") and formcheck.register" but i dont know how to implement?!
please can somebody help me with this?
Hi tobajarrat1,
This happens no entry for e.g. input_4 in the $form->data array. When you disable the input this will happen.
The simplest fix is probably to add a 'ghost' hidden input* with the same name at the beginning of the Form HTML. If the 'real' input has a value this will over-write the ghost, if it's disabled then the ghost value will be used. (Alternatively you can check the results after submission and add ghost values using PHP in a Custom Code action).
Bob
* If you use the ChronoForms Wizard to add elements these have a built-in 'ghost' option that is set on by default.
This happens no entry for e.g. input_4 in the $form->data array. When you disable the input this will happen.
The simplest fix is probably to add a 'ghost' hidden input* with the same name at the beginning of the Form HTML. If the 'real' input has a value this will over-write the ghost, if it's disabled then the ghost value will be used. (Alternatively you can check the results after submission and add ghost values using PHP in a Custom Code action).
Bob
* If you use the ChronoForms Wizard to add elements these have a built-in 'ghost' option that is set on by default.
thank you a lot!
i thought the hidden field will avert the submission because the same field name is required. now i understand the required tag works with the ids not with the field names!
i thought the hidden field will avert the submission because the same field name is required. now i understand the required tag works with the ids not with the field names!
This topic is locked and no more replies can be posted.