html - show * when field not valid -
i @ level 0 in breeze bear me. dont want ready made code of now. using breeze , want client side validation. want show "*" near html input if data entered not valid. below code bind data returned breeze.
<td > <input data-bind="value: name" /></td>
how can achieve using breeze? please let me know if there live example can refer to. tried googling couldnt find examples.
not breeze, pure js might help?
<!doctype html> <html> <head> <title>untitled</title> <style type='text/css'> span.red { color:red; } </style> <script> function validatefields() { //usually use regex check phones, example. // test if value '123456' in example. if ('123456' == document.getelementbyid('inpphone').value) { document.getelementbyid('spnphonevalid').innerhtml = ''; } else { document.getelementbyid('spnphonevalid').innerhtml = '*'; } } </script> </head> <body> phone number (only 123456):<input id='inpphone' onchange='validatefields();'> <span class='red' id='spnphonevalid'>*</span> </body> </html>
and of course it's client's usability , not instead of server-side validation!
Comments
Post a Comment