Bug Tracker

Modify

Ticket #5415 (closed feature: fixed)

Opened 4 years ago

Last modified 4 years ago

validate - getting error messages

Reported by: ThomasBauer Owned by:
Priority: major Milestone: 1.4
Component: plugin Version: 1.3.2
Keywords: validate Cc:
Blocking: Blocked by:

Description

It would be helpfull to egt by the attributes put in HTML (for example: validate="required: true, minlength:50") the responding message. Whith this you can add a help into your dise and user must not wait to get an error to know how to fill the form.

Change History

comment:1 Changed 4 years ago by ThomasBauer

I have now found a solution. I have extended the prototype definitons with the following code:

getMessage: function(element) {

element = this.clean( element ); if radio/checkbox, validate first element in group instead if (this.checkable(element)) {

element = this.findByName( element.name )[0];

} var rules = $(element).rules(); var dependencyMismatch = false; var listMessages = new Array(); for( method in rules ) {

var rule = { method: method, parameters: rules[method] }; var message = this.defaultMessage( element, rule.method ); if ( typeof message == "function" )

message = message.call(this, rule.parameters, element);

listMessages.push(message);

} return listMessages;

},

comment:2 Changed 4 years ago by john

  • Status changed from new to closed
  • Resolution set to fixed

Please file plugin bugs with the appropriate author on their bug tracker.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.