Every day is pleasant .. I have this java script code in my php file in which I used it as my validator .. for input in different fields in my text field ... my only problem is I donโt know how to create validation, which accepts only letters ... in my name and in the name field ... I look forward to any help thanks to a pleasant day ... I also wanted to know how about receiving numbers only in my area thanks ^^,
Here is the code:
<script type='text/javascript'> $(document).ready(function() { $('#employee_form').validate({ submitHandler:function(form) { $(form).ajaxSubmit({ success:function(response) { tb_remove(); post_person_form_submit(response); }, dataType:'json' }); }, errorLabelContainer: "#error_message_box", wrapper: "li", rules: { first_name: "required", last_name: "required", username: { required:true, minlength: 5 }, password: { <?php if($person_info->person_id == "") { ?> required:true, <?php } ?> minlength: 8 }, repeat_password: { equalTo: "#password" }, email: { required:true, email: "email" } }, messages: { first_name: "<?php echo $this->lang->line('common_first_name_required'); ?>", last_name: "<?php echo $this->lang->line('common_last_name_required'); ?>", username: { required: "<?php echo $this->lang->line('employees_username_required'); ?>", minlength: "<?php echo $this->lang->line('employees_username_minlength'); ?>" }, password: { <?php if($person_info->person_id == "") { ?> required:"<?php echo $this->lang->line('employees_password_required'); ?>", <?php } ?> minlength: "<?php echo $this->lang->line('employees_password_minlength'); ?>" }, repeat_password: { equalTo: "<?php echo $this->lang->line('employees_password_must_match'); ?>" }, email: { required: "<?php echo $this->lang->line('common_email_name_required'); ?>", email: "<?php echo $this->lang->line('common_email_invalid_format'); ?>" } } }); }); </script>
source share