Heya Folks,
I have a single page registration form, that presents a choice (dealer/customer), and then shows/hides various divs to present the required questions. The logic branches several times to tailor what is displayed.
I have now just relised after finally getting to the submit part that all my validation classes are going to stay active even when the div is not exposed🙂 . Ive tested this by submitting to one database with validation off, and that part works perfectly!
Simply put if a user picks option A, they never see the option B questions - however the validation criteria for them is not met, so the form errors on submit.
Likewise, I dont want to turn off validation for these fields in case they are displayed!
Does anyone have a strategy for deciding which additional fields to validate based on the status of variables/answers at the point of submit ??
I have a single page registration form, that presents a choice (dealer/customer), and then shows/hides various divs to present the required questions. The logic branches several times to tailor what is displayed.
I have now just relised after finally getting to the submit part that all my validation classes are going to stay active even when the div is not exposed🙂 . Ive tested this by submitting to one database with validation off, and that part works perfectly!
Simply put if a user picks option A, they never see the option B questions - however the validation criteria for them is not met, so the form errors on submit.
Likewise, I dont want to turn off validation for these fields in case they are displayed!
Does anyone have a strategy for deciding which additional fields to validate based on the status of variables/answers at the point of submit ??
Hi Mizpah,
The LiveValidation code has enable and disable functions that will turn the validation on and off. I guess that you'll need to call these on the code as it is displayed or hidden. See http://livevalidation.com/documentation
Bob
The LiveValidation code has enable and disable functions that will turn the validation on and off. I guess that you'll need to call these on the code as it is displayed or hidden. See http://livevalidation.com/documentation
Bob
Thanks Bob,
I have been reading around, I can see the principles, I am a little confused about where mooValidation.js is kicking in and where jsvalidation2.js is kicking in when I am looking at the default classes (i.e. <input class="cf_inputbox required"> etc) - are they both doing the same thing ?
Ultimately I think I want to add extra rules to existing class. i.e. its already required and alphanum. But (in this example) I want to add a between 5 and 16 chars rule as well. If we take the uname field as the case in point its also doing an ajax query on is the name in available (as per other threads in this forum).
Ultimately I will want to show one 'tick' 'cross' or 'hourglass' (whilst performing a lookup only) image in one div (after first focus), and the relevent error message in the next div if needed.
As such I am thinking I need to make sure that the mootools error output, ajax error output, and any livevalidation output I create all point to the same div.
Is the run order ajax >livevalidation direct from html > livevalidation.js > mootools.js ?
Still, I will park this and concentrate on my database submits - then return to this one, and try to build a simpler model for what I am after!
Cheers,
Miz
I have been reading around, I can see the principles, I am a little confused about where mooValidation.js is kicking in and where jsvalidation2.js is kicking in when I am looking at the default classes (i.e. <input class="cf_inputbox required"> etc) - are they both doing the same thing ?
Ultimately I think I want to add extra rules to existing class. i.e. its already required and alphanum. But (in this example) I want to add a between 5 and 16 chars rule as well. If we take the uname field as the case in point its also doing an ajax query on is the name in available (as per other threads in this forum).
Ultimately I will want to show one 'tick' 'cross' or 'hourglass' (whilst performing a lookup only) image in one div (after first focus), and the relevent error message in the next div if needed.
As such I am thinking I need to make sure that the mootools error output, ajax error output, and any livevalidation output I create all point to the same div.
Is the run order ajax >livevalidation direct from html > livevalidation.js > mootools.js ?
Still, I will park this and concentrate on my database submits - then return to this one, and try to build a simpler model for what I am after!
Cheers,
Miz
Hi Mizpah,
I don't think that moovalidation.js is used in the current release (it's a hang-over from the older versions which used 'Really Easy Validation').
LiveValidation does have a length validation but it's not included by default in the ChronoForms setup (the included validations were also inherited from the previous versions). I think you can add a custom validation but off the top of my head I forget exactly how to do it.
And there's no Ajax involved in the validation - not sure where that bit came from.
Bob
I don't think that moovalidation.js is used in the current release (it's a hang-over from the older versions which used 'Really Easy Validation').
LiveValidation does have a length validation but it's not included by default in the ChronoForms setup (the included validations were also inherited from the previous versions). I think you can add a custom validation but off the top of my head I forget exactly how to do it.
And there's no Ajax involved in the validation - not sure where that bit came from.
Bob
Heya Bob,
Badly eplained by me as usual - I was simply reffering to the fact that I have an ajax check against username and email, (i.e. is it available) well as the default validation provided by the chronoforms classes. Should it not be, I want to output an error in the same div - and set the field to invalid.
I am guessing I may need to make my own class with all the bits in I need, will have a play and then elaborate later!
Badly eplained by me as usual - I was simply reffering to the fact that I have an ajax check against username and email, (i.e. is it available) well as the default validation provided by the chronoforms classes. Should it not be, I want to output an error in the same div - and set the field to invalid.
I am guessing I may need to make my own class with all the bits in I need, will have a play and then elaborate later!
hello,
I have a similar issue as in the first post. Unfortunately I'm not very skilled with php nor JS. I've read few topics about that and the conditional fields work but have a problem with setting the conditional validation. I've read the LiveValidation documention and I think I know how it works, also read topics of mizpah registration but still don't know to make it work😟
What should be the code to validate certain fields when the one of the choices is make. I paste the code here:
If I use the LiveValidation do I have to validate all of the fields using the LV?
Should I put the validation code into the if statement i.e. radio00 button choosed the fragment of the script:
of course the above doesn't work but am I getting the main idea?
Thanks for help.
I have a similar issue as in the first post. Unfortunately I'm not very skilled with php nor JS. I've read few topics about that and the conditional fields work but have a problem with setting the conditional validation. I've read the LiveValidation documention and I think I know how it works, also read topics of mizpah registration but still don't know to make it work😟
What should be the code to validate certain fields when the one of the choices is make. I paste the code here:
<?php
$script = "
window.addEvent('domready', function() {
var selectDiv = function() {
if ( $('radio00').checked == true ) {
$('wiek1').setStyle('display', 'block');
$('wiek2').setStyle('display', 'none');
$('wiek3').setStyle('display', 'none');
}
if ( $('radio01').checked == true ) {
$('wiek1').setStyle('display', 'block');
$('wiek2').setStyle('display', 'block');
$('wiek3').setStyle('display', 'none');
}
if ( $('radio02').checked == true ) {
$('wiek1').setStyle('display', 'block');
$('wiek2').setStyle('display', 'block');
$('wiek3').setStyle('display', 'block');
}
};
$('radio00').addEvent('change', selectDiv);
$('radio01').addEvent('change', selectDiv);
$('radio02').addEvent('change', selectDiv);
});
";
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration($script);
?>
// some other code of the form
<div class="form_item">
<div class="form_element cf_radiobutton">
<label class="cf_label" style="width: 150px;">Ile dzieci chodzi do Przedszkola: *</label>
<div class="float_left">
<input value="1" title="" class="radio validate-one-required" id="radio00" name="radio0" type="radio" />
<label for="radio00" class="radio_label">1</label>
<br />
<input value="2" title="" class="radio validate-one-required" id="radio01" name="radio0" type="radio" />
<label for="radio01" class="radio_label">2</label>
<br />
<input value="3" title="" class="radio validate-one-required" id="radio02" name="radio0" type="radio" />
<label for="radio02" class="radio_label">3</label>
<br />
</div>
</div>
<div class="cfclear">Â </div>
</div>
<div id="wiek1" style='display:none;'>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Rok urodzenia dziecka: *</label>
<input class="cf_inputbox required validate-number" maxlength="150" size="30" title="" id="text_1" name="wiek_1" type="text" />
</div>
<div class="cfclear">Â </div>
</div>
</div>
<div id="wiek2" style='display:none;'>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Rok urodzenia drugiego dziecka: *</label>
<input class="cf_inputbox required validate-number" maxlength="150" size="30" title="" id="text_2" name="wiek_2" type="text" />
</div>
<div class="cfclear">Â </div>
</div>
</div>
<div id="wiek3" style='display:none;'>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">Rok urodzenia trzeciego dziecka: *</label>
<input class="cf_inputbox required validate-number" maxlength="150" size="30" title="" id="text_4" name="wiek_3" type="text" />
</div>
<div class="cfclear">Â </div>
</div>
</div>
If I use the LiveValidation do I have to validate all of the fields using the LV?
Should I put the validation code into the if statement i.e. radio00 button choosed the fragment of the script:
<?php
$script = "
window.addEvent('domready', function() {
var selectDiv = function() {
if ( $('radio00').checked == true ) {
$('wiek1').setStyle('display', 'block');
$('wiek2').setStyle('display', 'none');
$('wiek3').setStyle('display', 'none');
var wiek_1 = new LiveValidation('wiek_1');
wiek_1.enable();
var wiek_2 = new LiveValidation('wiek_2');
wiek_2.disable();
var wiek_3 = new LiveValidation('wiek_3');
wiek_3.disable();
}
if ( $('radio01').checked == true ) {
$('wiek1').setStyle('display', 'block');
$('wiek2').setStyle('display', 'block');
$('wiek3').setStyle('display', 'none');
var wiek_1 = new LiveValidation('wiek_1');
wiek_1.enable();
var wiek_2 = new LiveValidation('wiek_2');
wiek_2.enable();
var wiek_3 = new LiveValidation('wiek_3');
wiek_3.disable();
}
if ( $('radio02').checked == true ) {
$('wiek1').setStyle('display', 'block');
$('wiek2').setStyle('display', 'block');
$('wiek3').setStyle('display', 'block');
var wiek_1 = new LiveValidation('wiek_1');
wiek_1.enable();
var wiek_2 = new LiveValidation('wiek_2');
wiek_2.enable();
var wiek_3 = new LiveValidation('wiek_3');
wiek_3.enable();
}
};
$('radio00').addEvent('change', selectDiv);
$('radio01').addEvent('change', selectDiv);
$('radio02').addEvent('change', selectDiv);
});
";
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration($script);
?>
of course the above doesn't work but am I getting the main idea?
Thanks for help.
Hi Tryt,
Am back after being dragged away again by work - I will take a closer look at this later on (probably early morning UK time) and see what I can work out - Unless Bob beats me to it of course!
/Miz
Am back after being dragged away again by work - I will take a closer look at this later on (probably early morning UK time) and see what I can work out - Unless Bob beats me to it of course!
/Miz
This topic is locked and no more replies can be posted.