Bug Tracker

Opened 7 years ago

Closed 7 years ago

#5415 closed feature (fixed)

validate - getting error messages

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

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 (2)

comment:1 Changed 7 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 7 years ago by john

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

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

Note: See TracTickets for help on using tickets.