Forums

Validation in FireFox works, does not in IE

Max_admin 18 Mar, 2008
Hi Brian,

Did you try to switch to mootools library ? which IE fails ? 7 or 6 or both ?

Cheers

Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Sapient 18 Mar, 2008
Greetings Max,
I am using IE 7. I initially used prototype and it submitted without validation. I switched to mootools and it caught the first validation/required and ignored the remainder.

Hope this helps,
Brian

From a new user prospective, great component... thanks
Sapient 18 Mar, 2008
Update...

I just tried the Firefox browser after switching to mootools and the same thing. Caught the first one and ignored the remainder.

Thanks,
Brian
Sapient 18 Mar, 2008
I started looking through the Forum and then reviewed the code again. Here are a couple of things I noticed.

It is my understanding the you should not have class defined
within the form tags. Use div tags. In most of my code I used <p> tags except for the example below. Does the paragraph tag make a difference?

In the code below I set it up based on some example code from Andrew Tetlaw's site.

Now this bit of code follows the first SUCCESSFUL validation. After that, it falls through. So I am starting to think this is my problem.

Note the class in the form tag. How else could this be written. Also note it is a radio button choice.


						<div class="field-label">
      <p class="details">
						Are you uploading elements, such as photos?
        <input type="radio" name="elem" value="Yes_elem" id="elemyes"> Yes 
        <input type="radio" name="elem" value="No_elem" id="elemno" class="validate-one-required"> No (Required)
      </p>
						</div>




Thanks,
Brian
Max_admin 18 Mar, 2008
Hi Brian,

do you have spaces between fields names in the validation tab ?

you should have them like this : field1,field2,field3

Cheers

Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Sapient 18 Mar, 2008
Good Day Max,
I do not. I spent a couple of hours trying different things today and still no validation on the radio buttons. I believe the issue is with the class defined in the form tag (class="validate-one-required"). Or the syntax in general.

Everything validates correctly (FF & IE), if I eliminate the validation on the radio buttons.

So the real issue is not that things will not validate, but that the radio buttons (when validated) prevents validation on everything that follows.

Thanks,
Brian
Max_admin 19 Mar, 2008
Hi Brian,

I remember that I have seen someway to get this to work before on the validation website, and there was some users comments too about the issue, please look at them and may be they will be useful!

you can check the validation js file too for the formulas of validation!

Let us know how it will go!

Cheers

Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Max_admin 19 Mar, 2008
you can check their validation demos too and see the page source to know how exactly yours should be to get it working!😉
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
AdamG 19 Mar, 2008
Hi!

I am having the same issues.

I am using IE7. Joomla 1.5 and latest ChronoForms.


When I use mootools and the forms adress: index.php?option=com_chronocontact&chronoformname=Formname
It will work but not on the selection box (wont give error, nothing happeneds) or the radio buttons (radio button will show javascript error).

Exactly same thing happeneds when i include it in content.

-------------------

When I use validation prototype and the forms adress: index.php?option=com_chronocontact&chronoformname=Formname
Then everything works fine.

But when i use prototype and include it in the content the validation does not work at all.

I viewed the source of the page and noticed that I have two lines that might cause a problem:

  <script type="text/javascript" src="/media/system/js/mootools.js"></script>
  <script type="text/javascript" src="/media/system/js/caption.js"></script>

When I remove this two lines (change the javascript filenames so they wont be found) the prototype validation works in content too, but mootools is still the same.<br><br>Post edited by: AdamG, at: 2008/03/19 16:36
GreyHead 19 Mar, 2008
Hi AdamG,

caption.js is a file loaded by Joomla - I think it just wraps the captions on images. Mootools.js it the Mootools toolkit, also loaded by Joomla (caption.js and other scripts use it).

So the problem that you remove by taking those out is the conflict between Prototype & Mootools.

Sounds as though we still need a fix for the underlying problems in the Mootools based validation.

Bob
AdamG 19 Mar, 2008
I have solved the mootools issue.
Now both select and radio works perfectly fine!!
EDIT: Tested in IE7, should work on firefox. The changes are very basic.

Locate this code in mooValidation.js
			}],
	['validate-one-required', 'Please select one of the above options.', function (v,elm) {
				var p = elm.parentNode;
				var options = p.getElementsByTagName('INPUT');
				return $A(options).any(function(elm) {
					return $F(elm);
				});
			}]


Replace with this code
			}],
	['validate-selection', 'Please make a selection.', function(v,elm){
				return elm.options ? elm.selectedIndex > 0 : !Validation.get('IsEmpty').test(v);
			}],
	['validate-one-required', 'Please select one of the above options.', function (v,elm) {
				var p = elm.parentNode;
				var options = p.getElementsByTagName('INPUT');
				for(i=0; i<options.length; i++){
					if(options[i].checked == true) {
						return true;
					}
				}
			}]

I marked the changes in red.
EDIT: I tryed to mark the changes in red, didnt work.

Strange thing was that mooValidate.js didnt have any validate-selection at all. I copied the one from prototype, it works.<br><br>Post edited by: AdamG, at: 2008/03/19 19:14
AdamG 19 Mar, 2008
Chrono developers: I suggest that you implement this changes in the mooValidate.js file.
GreyHead 20 Mar, 2008
Hi Adam,

Many thanks for this, I'll update a copy of the file and send it to Max.

Bob

PS later: modified file attached

[file name=mooValidation-11383c2e67183f66cb1494545e4a9d14.zip size=2804]http://www.chronoengine.com/components/com_fireboard/uploaded/files/mooValidation-11383c2e67183f66cb1494545e4a9d14.zip[/file]<br><br>Post edited by: GreyHead, at: 2008/03/19 21:58
Max_admin 20 Mar, 2008
Hi Adam,

Thank you very much, but how this solved the radios issue ? It should fix the SELECT field validation only, am I wrong ?

Regards

Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
AdamG 20 Mar, 2008
Hi Admin,

It actually does solve the radio issue.
Before it used a prototype validation method (the file mooValidate.js, is not built for mootools, its copied from prototype). I changed does few lines (three lines) and put in a more common method of checking if there is any radio button checked.

You can try the old file with radio and the one I made. Mine works.
EDIT: Go back to the post, where I showed my changes. It's more clear there what I changed.
I added the validate-selection and changed the last three lines on validate-one-required.

Regards
Adam<br><br>Post edited by: AdamG, at: 2008/03/20 11:47
AdamG 20 Mar, 2008
Hi all,

I just noticed that this also fixes the checkbox problem since the radio and checkbox uses the same verification method (validate-one-required).

Verified: I tryed checkboxes with the old file and the new one. It didn't work with the old one.

Regards
Adam
acmeview 21 Mar, 2008
still don't work,thanks.
GreyHead 21 Mar, 2008
Hi acmeview,

What doesn't work and where?

Bob
Max_admin 22 Mar, 2008
Thanks Adam, I will test it too!

Cheers

Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Bacardo 28 Jun, 2008
Thanks, it's work fine!

I've used in my form, and updated the mooValidate.js translating and adding the fixes.

Thanks!

Bacardo.
This topic is locked and no more replies can be posted.