Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

javascript - jquery validation working on some browsers, but not on others -


why work people, , doesn't others? others click button , doesn't work. started doing after added nospaces validation method. suggestions appreciated.

<form method="post" action="#" id="client_form" class="order-form"> <input type="text" id="user_name" name="user_name" class="req nospaces" /> </form>  <button id="client_next_btn"><?php echo($content->getstring('order')); ?></button> <script type="text/javascript">  $(function () { jquery.validator.addclassrules('req', { required: function (el) { return $(el).is(':visible') } });  var nums = ['0','1','2','3','4','5','6','7','8','9']; var letters = ['q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m']; var alphanumeric = nums.concat(letters);  jquery.validator.addmethod("nospaces", function(value, element) {     var val = value.split("");     var bool = true;     (var in val)     {         if (jquery.inarray(val[i], alphanumeric) == -1)         {             bool = false;             break;         }     }     return bool; }, "* <?php echo ($content->getstring('no_spaces')); ?>");  $('#client_form').validate(); $('#client_next_btn').click(function () {     $('#client_message').empty();      if ($('#client_form').validate().form())     {                 alert('works');             }     } 

}

just tip, can rid of this:

jquery.validator.addclassrules('req', {    required: function (el) { return $(el).is(':visible') }  }); 

and use built in required class, add ignore option .validate() call exclude :hidden elements, this:

$('#client_form').validate({ ignore: ':hidden' }); 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -