Forums

Validation problem

thomaskremer 27 Apr, 2008
Hi,
I realy like your chronoforms! Everything is working fine... except the validation-part.
I checked the forum and made sure there isn't any space in the names. Still doesn't validate.
Could you have a look at my form?
Tanks!
Thomas

[file name=Inschrijvingen.cfbak size=15089]http://www.chronoengine.com/components/com_fireboard/uploaded/files/Inschrijvingen.cfbak[/file]
GreyHead 27 Apr, 2008
Hi Thomas,

Because of the way that the validation works you cannot have 'class' attributes in the 'input' tags. If you do, then CF adds a second class attribute and everything gets confused.

You can work around this by putting the css class attributes in wrapping tags; or, IIRC, someone posted a code hack here recently that will work provided that you have the 'name' and 'class' attributes as the first two.

I'm also not sure that 'required' works with select boxes, you may need 'select one required' instead.

Get the validation working with a couple of simple input tags, then add the others.

Bob
thomaskremer 28 Apr, 2008
Thanks for your quick answer! I'll try to simplify the code, without classes.
Thanks for this great component!
Thomas
cuhuak 28 Apr, 2008
Hi all. I tried everything with this code. but validation does not works:
<script src="test_radio_files/mootools.js" type="text/javascript"></script>
<script src="test_radio_files/mooValid.js" type="text/javascript"></script>
              
<form name="ChronoContact_kettel1" id="ChronoContact_kettel1" method="post" action="http://localhost/test/ru/index.php?option=com_chronocontact&task=send&chronoformname=kettel1" >
<input type="text" name="myin" class="required">
 <div>sex: M <input type="radio" name="sex" value="m" class="validate-one-required"> - F <input type="radio" name="sex" value="f" class="validate-one-required"></div>
<input type="submit" value="go" />
</form>
          <script type="text/javascript">
        function formCallback(result, form) {
          window.status = "valiation callback for form '" + form.id + "': result = " + result;
        }
        var valid = new Validation('ChronoContact_kettel1', {immediate : true, onFormValidate : formCallback});
      </script>

How to use "validate-one-required" (moovalidate, with prototype all ok) ??
Could you give a little example where this feature works?

To thomaskremer. I have some code that can help u. this code inserts validation-classes into tags where class attribute were specified (look my more ealier posts).
cuhuak 29 Apr, 2008
i have solved this problem with moovalidate(one-reuquired).
Just replace the code with this:
	['validate-one-required', ''Please select one of the above options.', function (v,elm) {
				var p = elm.parentNode;
				var options = p.getElementsByTagName('INPUT');
				b = false;
				($A(options)).each(function(elm) {
					if (elm.checked==true) {
					    b = true;
					}
				});
				return b;
			}],

it is not so elegant but it works (i am layman in the moo-library).

Post edited by: cuhuak, at: 2008/04/29 10:26<br><br>Post edited by: cuhuak, at: 2008/04/29 10:27
Max_admin 01 May, 2008
Thanks cuhuak!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.