Creating Dynamic Select Box Using PHP

Posted on Leave a commentPosted in PHP

function drop_down($table,$label,$value) { /* @table : Table name from which drop down will genrate @label : Label name wich display on drop down in user level @value : Value wich will associate on dropdown on value attribute */ $qs=”select * from $table”; $data=mysql_query($qs); $result=””; while($row=mysql_fetch_array($data)) { $result.=”<option value=’”.$row[$value].”‘>”.$row[$label].”</option>”; } return ($result); }

JQuery Validation for Data List

Posted on Leave a commentPosted in JQuery

JQuery Method by which we can validate the value is chosen from data list or not .   jQuery.validator.addMethod(“chekMatrix”,function(value, element) { var val=$(“#payInMatrix”).val(); var obj=$(“#matrix”).find(“option[value=’”+val+”‘]”) if(obj !=null && obj.length>0) { return true; } },’Please Enter only from list’);

JQuery Validation for AlphaNumeric Field

Posted on Leave a commentPosted in JQuery

jQuery.validator.addMethod(‘alphanum’, function(value, element) { return this.optional(element) || /^[a-z0-9]+$/i.test(value); }, “This field contain only letters and numbers.”);     Example:   $(‘#frm3’).validate({ rules: { roll: { alphanum:true } } }, errorClass: ‘help-block’, errorElement: ‘span’, highlight: function (element, errorClass, validClass) { $(element).parents(‘.form-group’).removeClass(‘has-success’).addClass(‘has-error’); }, unhighlight: function (element, errorClass, validClass) { $(element).parents(‘.form-group’).removeClass(‘has-error’).addClass(‘has-success’); } });