APEX-AT-WORK no image
Tags:

Using jQuery and Regular Expression to validate form fields

Von Tobias Arnhold 5.03.2012
This is a simple example to validate an APEX item with regular expressions (on client side):
v_text = $('#P1_MY_ITEM').val();          
v_regex = /^[a-zA-Z0-9_ .,-:;!?&\(\)"\t\r\n]+$/;   
/* only number: /^[0-9]+$/; */
/* only character: /^[a-zA-Z]+$/; */
if(!v_regex.test(v_text)){
    alert('ERROR');
}else{
    alert('OK');
}
Important links to the topic:
http://www.jquery4u.com/syntax/jquery-basic-regex-selector-examples/
http://www.designchemical.com/blog/index.php/jquery/form-validation-using-jquery-and-regular-expressions/
http://mdskinner.com/code/email-regex-and-validation-jquery

Post Tags:

No Comment to " Using jQuery and Regular Expression to validate form fields "