Skip to main content
Participant
August 18, 2011
Question

Form Validation working in FF but not in IE8

  • August 18, 2011
  • 1 reply
  • 580 views

Hello All,

Following is my code snippet ....  (This is a function which checks if the password fields are empty then throws the validation message.

$("#passwordForm").validate({

rules: {

newPassword: { required:

true },

confirmNewPassword: { required:

true ,equalTo:"#newPassword" }

},

messages: {

newPassword: { required:

"This is a required field." },

confirmNewPassword: { required:

"This is a required field." }

},

 

/* error placement configuration */

errorElement:

"div",

errorPlacement:

function(error, element) {

// test to see if element has associated label; if so then use the label for placement of error message instead

elementName = element.attr(

'name');

testElement = $(

"#" + elementName + "Label");

if ( testElement.length > 0 ) {

element = testElement;

}

offset = element.offset();

error.insertBefore(element)

error.addClass(

'message'); // add a class to the wrapper

error.css(

'position', 'absolute');

error.css(

'left', offset.left + element.outerWidth() );

error.css(

'top', offset.top -10);

}

});

The above snippet works correclty in mozila firefox , but while working with IE8 the validation is not happening...

Can some 1 please help?

Thanks in advance

kausty05

This topic has been closed for replies.

1 reply

Inspiring
August 18, 2011

If all you want to do is ensure that the two fields have values, why not use cfinput required="yes" ?