Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9958 closed bug (invalid)

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 -->

Change History (3)

comment:1 Changed 6 years ago by anonymous

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

comment:2 Changed 6 years ago by timmywil

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.

comment:3 Changed 6 years ago by anonymous

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.

Note: See TracTickets for help on using tickets.