Bug Tracker

Modify

Ticket #2456 (closed feature: fixed)

Opened 5 years ago

Last modified 5 years ago

[validate] Accept dependency expression for every method

Reported by: joern Owned by: joern
Priority: major Milestone:
Component: plugin Version:
Keywords: Cc:
Blocking: Blocked by:

Description (last modified by joern) (diff)

Usage:

billingAddress: {
  required:true,
  minlength:5
  equalTo: {
    param: "#shippingaddress",
    depends: "#compare:checked"
  }
}

Here the billing address must be the same as the shipping addres, but only if some checkbox #compare is checked.

Every method'd accept that {depends:expression} object as the parameter, skipping the method if it doesn't match. The expression is the same as what required accepts, but doesn't kill the chain as required does. Even required can accept the depends parameter.

Implementation: Extend normalizeRule to check for the parameter. If it has a depends-property, evaluate it. If it returns true, return a normal {name:param} rule. If not, drop the rule. Return normal rule if no param specified or no depends-property.

Change History

comment:1 Changed 5 years ago by joern

  • Description modified (diff)

comment:2 Changed 5 years ago by joern

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

Fixed in [4862]. Thanks Dan!

comment:3 Changed 5 years ago by scott.gonzal

  • Status changed from closed to reopened
  • Resolution fixed deleted

Jörn closed the wrong ticket...

comment:4 Changed 5 years ago by scott.gonzal

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

Fixed in [4872] and [4889].

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.