angularjs - How to fire fluent Validation only on Reject Button Click -


i using simple angular form fluent validations. having 2 button. 1 save , reject , below have reject reason textbox.

in fluent validations using validate reject reason if empty.

but problem getting save button click validating reject reason empty. want validate when click reject reason button.

 rulefor(i => i.rejectreason)                 .notempty()                 .withmessage("reject reason required")); 

what tried having flag when button clicked making flag true can validate message problem after enter reject reason , hit reject button flag still true , validating me message. correct way or how shall validate

below have tried

 rulefor(i => i.rejectreason)                 .notempty()                 .when((i) =>                 {                         return i.showrejectreason;                  })                  .withmessage("reject reason required"); 


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -