Skip to main content

Bug Tracker

Side navigation

#9958 closed bug (invalid)

Opened August 02, 2011 07:36PM UTC

Closed August 02, 2011 08:06PM UTC

Last modified August 03, 2011 08:10AM UTC

Validation plugin does not work inside buttons

Reported by: anonymous Owned by:
Priority: low Milestone: None
Component: misc Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:
Description

When an in-line input validation is inside a button, which is inside a form tag, Validation does not work. I expect the error message to appear, but it does not. I tested both forms of button, i.e., input type="button" and <button>. Neither work. When I remove the button code, the input tag validates and Validation produces the error message. Of course, my page no longer has a button, so this is not a fix. I used the current version of jQuery via Google, Firefox 4.0, and WindowsXP. The code, with button, is below.

HTML:

<form action = "rentInputProcessor.php" method="POST" id = "rentDataInput" name = "rentDataInput" accept-charset = "utf-8" enctype = "multipart/form-data">

<input type="button" id="editPosting" name="editPosting" title="creates a dialog box to begin editting an existing posting" value="Edit an existing posting" />

<div id="editEntryItems" style='display: none;' > <!-- used to create the dialog box for editing existing postings -->

<label for="contactEmailAddress"></label>

<p>My E-Mail Address Is:</p>

<input type="text" id="contactEmailAddress" name="contactEmailAddress" class="validCharsCheck" size="50" maxlength="50" />

<p>My Password Is:</p>

<label for="contactPassword"></label>

<input type="password" name="contactPassword" id="contactPassword" class="validCharsCheck" size="12" maxlength="12" />

jQuery:

check for unwanted characters

$.validator.addMethod('validCharsCheck', function (value)

{

var result = true;

unwanted characters

var iChars = "!@#$%^&*()=[]\\\\\\;/{}|\\":<>?"; //what about . , ' + - They are useful, but can be used poorly

for (var i = 0; i < value.length; i++) {

if (iChars.indexOf(value.charAt(i)) != -1) {

return false;

}

}

return result;

},

'Use numbers and alphabetic characters');

$("#rentDataInput").validate({

debug: true, )};

</div> <!--End editEntryItems -->

Attachments (0)
Change History (3)

Changed August 02, 2011 07:41PM UTC by anonymous comment:1

The author box won't accept my email or user name. Mike Laird submitted this bug report about Validation.

Changed August 02, 2011 08:06PM UTC by timmywil comment:2

component: unfiledmisc
priority: undecidedlow
resolution: → invalid
status: newclosed

This is the bug tracker for jQuery core. Please consult the issue tracker for the validation plugin and double check that you have the latest version: https://github.com/jzaefferer/jquery-validation/issues.

Changed August 03, 2011 08:10AM UTC by anonymous comment:3

I am using Validation 1.8.1, and the problem occurs with all 3 ways of setting up a validation - in-line, key-value pairs, and rule() commands.