javascript - using datepicker to change dates and submitting form does not jump to control action but falls over on html debug points -


i have following html form:

@using(html.beginform("editcourse", "admin", formmethod.post, new { enctype = "multipart/form-data" }))       {                       <div class="twelve columns" style="margin:10px 0px 30px 30px">           <div class="row">             <div class="six columns" style="margin-left:-5px; width:320px;">               @html.labelfor(c => c.course.name)               @html.editorfor(c => c.course.name)               @html.hiddenfor(c => c.course.courseid)             </div>             <div class ="six columns" style="width:320px;">               @html.labelfor(c => c.course.author)               @html.editorfor(c => c.course.author)             </div>              <div class="row">               <div class="twelve columns" style="width:640px;">                 @html.labelfor(c => c.course.description)                 @html.editorfor(c => c.course.description)               </div>             </div>              <div class="row">               <div class="six columns" style="width:320px;">                    @html.labelfor(c => c.course.participationpoints)                 @html.editorfor(c => c.course.participationpoints)               </div>               <div class="six columns" style="width:320px; float:left;">                 @html.labelfor(c => c.course.expirydate)                 <input type="text" id="expires" name="expires" /><br />                  @html.editorfor(c => c.course.expirydate)               </div>             </div>              <div class="row">               <div class="twelve columns" style="width:640px;">                 @html.labelfor(c => c.course.categorygroupid, "category")                 @html.dropdownlistfor(c => c.course.categorygroupid, new selectlist(model.categorygroups, "categorygroupid", "categorygroupname", model.course.categorygroupid))               </div>             </div>              <div class="row">               <div class="six columns">                 @html.hiddenfor(c => c.course.uploaddate)               </div>             </div>              <div class="twelve columns">               <input id="filesubmit" type="submit" class="medium button bottom20 top20" value="save changes" style="margin-left:235px;"/>             </div>           </div>         </div>                       } 

within editfor expirydate showing full string format of datetime ui want user display shortdatestring in ui have written following javascript:

$(document).ready(function () {     $('#expires').datepicker({ dateformat: 'dd/mm/yy' });     $('#expires').val('@model.course.expirydate.tostring("dd/mm/yyy")');      $("#expires").change(function () {         var currentdate = $(this).val();         var array = currentdate.split("/", 3);         var day = array[0];         var month = array[1];         var year = array[2];         $('#course_expirydate').val(month + "/" + day + "/" + year + " 23:59:59");     }); }); 

when page loads date correctly displayed in input box have added display in uk format , have shown editorfor expirydate ensure changes box updated in format in editor for.

if try edit model without changing date works expected , jumps straight controller process form. if change date not , jumps html form failing find of things rendered on page.

what causing issue?


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -