0

The question is related to validating/catching the data before the binding update, in a manner that you can implement validation. Does anyone have any examples that are a generic type implementation, not specific of doing something in a similar manner? I know there are many ways to probably handle this, but I do not want to have to write validation for specific instances. To give a brief understanding, we are using ketchup plugin along side with jsviews, and some custom validation methods. I appreciate the response I have already received, but changed the manner I was asking the question, to maybe get some other responses.

Thanks in advance!

Ronny
  • 471
  • 1
  • 5
  • 11
  • Just a heads up that I will try to get some samples out soon that cover scenarios related to validation etc. I haven't answered here yet, because I want to get those samples created first - as a more effective way of making suggestions... – BorisMoore Jun 20 '13 at 19:50
  • I was implementing a "hack" around it, to just not update the views if a validation was triggered. At the moment in this context, that is referring to ketchup. It was what was already implemented. I was just hoping for a feature to be implemented. Thanks again, and keep up the great work! – Ronny Jun 21 '13 at 19:03

1 Answers1

1

I mentioned in the comment above that there would be some samples related to validation. Here are the links:

BorisMoore
  • 8,444
  • 1
  • 16
  • 27
  • is there a way to check whether the HTML generated from a template is valid. I mean if I want to check the state before submission of data ? – Avidev9 Nov 10 '13 at 15:24
  • You don't want to insert invalid HTML into the DOM - so you need to validate programmatically before rendering and linking the data into the DOM. You can have an "onBeforeChange" handler, and before deciding whether to return false or not, you can simply render any relevant template programmatically - var html = template.render(currentData); and parse the HTML yourself. There is no special built-in support to do that. But if the template is valid, the rendered HTML will generally be too, or else you should probably define the validation constraints directly on the data... – BorisMoore Nov 12 '13 at 01:40