2

Im building a Jquery form validation plugin. my concern is that my plugin does not return the object for chaining purpose. but rather it returns an array. the array is one of the two

  1. array1 contains all the required field names which are not filled in. but if all the required fields are filled in then this is ignored.
  2. array2 will be returned only if value inside form input element is not matching(regex). other wise a true is returned if all the required fields are filled in and the data are correct in the form input elements and the form will be submitted.

So any suggestion please, if you think this is bad, because the plugin should return the object for chaining purpose. or if you think im doing this its all ok. thanks for your help in advance

1 Answer 1

1

Make your plugin require a callback as a parameter. Instead of returning your array, you can pass it to the callback. This will get the data out, but let you still return the object as well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.