2012-04-24 2 views
1

DateForm 속성/inputfields에 DisplayFormat 및 datepicker를 추가 했으므로 양식 전송이 중단되었습니다. 나는 어떤 오류도 내지 않는다 (크롬 F12 또는 비주얼 스튜디오에서).ASP.NET 면도기 : 양식을 제출하지 않았습니다.

편집 : Displayformat을 dd/MM/yyyy로 설정하고 datepicker를 "dd/mm/yyyy"로 설정했습니다. 그러나 그것은 그것도 해결하지 못했습니다.

@using (Html.BeginForm("CreateCampaign", "Home")) { 
    @Html.ValidationSummary(true) 
    <fieldset> 
     <legend>Campaign</legend> 
     <div class="editor-label"> 
      @Html.LabelFor(model => model.Campaign.CampaignName) 
     </div> 
     <div class="editor-field"> 
      @Html.EditorFor(model => model.Campaign.CampaignName) 
      @Html.ValidationMessageFor(model => model.Campaign.CampaignName) 
     </div> 

     <div class="editor-label"> 
      @Html.LabelFor(model => model.Campaign.WebsiteUrl) 
     </div> 
     <div class="editor-field"> 
      @Html.EditorFor(model => model.Campaign.WebsiteUrl) 
      @Html.ValidationMessageFor(model => model.Campaign.WebsiteUrl) 
     </div> 

     <div class="editor-label"> 
      @Html.LabelFor(model => model.Campaign.PrivacyPolicyUrl) 
     </div> 
     <div class="editor-field"> 
      @Html.EditorFor(model => model.Campaign.PrivacyPolicyUrl) 
      @Html.ValidationMessageFor(model => model.Campaign.PrivacyPolicyUrl) 
     </div> 

     <div class="editor-label"> 
      @Html.LabelFor(model => model.Campaign.TermsUrl) 
     </div> 
     <div class="editor-field"> 
      @Html.EditorFor(model => model.Campaign.TermsUrl) 
      @Html.ValidationMessageFor(model => model.Campaign.TermsUrl) 
     </div> 

     <div class="editor-label"> 
      @Html.LabelFor(model => model.Campaign.PricepageUrl) 
     </div> 
     <div class="editor-field"> 
      @Html.EditorFor(model => model.Campaign.PricepageUrl) 
      @Html.ValidationMessageFor(model => model.Campaign.PricepageUrl) 
     </div> 

     <div class="editor-label"> 
      @Html.LabelFor(model => model.Campaign.Startdate) 
     </div> 
     <div class="editor-field"> 
      @Html.EditorFor(model => model.Campaign.Startdate) 
      @Html.ValidationMessageFor(model => model.Campaign.Startdate) 
     </div> 

     <div class="editor-label"> 
      @Html.LabelFor(model => model.Campaign.Enddate) 
     </div> 
     <div class="editor-field"> 
      @Html.EditorFor(model => model.Campaign.Enddate) 
      @Html.ValidationMessageFor(model => model.Campaign.Enddate) 
     </div> 

     <div class="editor-label"> 
      @Html.LabelFor(model => model.Campaign.Starthour) 
     </div> 
     <div class="editor-field"> 
      @Html.DropDownListFor(model => model.Campaign.Starthour, new SelectList(Model.Hours)) 
      @Html.ValidationMessageFor(model => model.Campaign.Starthour) 
     </div> 

     <div class="editor-label"> 
      @Html.LabelFor(model => model.Campaign.Endhour) 
     </div> 
     <div class="editor-field"> 
      @Html.DropDownListFor(model => model.Campaign.Endhour, new SelectList(Model.Hours)) 
      @Html.ValidationMessageFor(model => model.Campaign.Endhour) 
     </div> 

     <div class="editor-label"> 
      @Html.LabelFor(model => model.Campaign.PMAM) 
     </div> 
     <div class="editor-field"> 
      @Html.DropDownListFor(model => model.Campaign.PMAM, new SelectList(Model.AMPM, "key", "value")) 
      @Html.ValidationMessageFor(model => model.Campaign.PMAM) 
     </div> 

     <div class="editor-label"> 
      @Html.LabelFor(model => model.Campaign.Language) 
     </div> 
     <div class="editor-field"> 
      @Html.DropDownListFor(model => model.Campaign.Language, new SelectList(Model.Languages, "key", "value")) 
      @Html.ValidationMessageFor(model => model.Campaign.Language) 
     </div> 

     <div class="editor-label"> 
      @Html.LabelFor(model => model.Campaign.FK_ID_MerchantApp) 
     </div> 
     <div class="editor-field"> 
      @Html.EditorFor(model => model.Campaign.FK_ID_MerchantApp) 
      @Html.ValidationMessageFor(model => model.Campaign.FK_ID_MerchantApp) 
     </div> 

     <div class="editor-label"> 
      @Html.LabelFor(model => model.Campaign.CampaignType) 
     </div> 
     <div class="editor-field"> 
      @Html.DropDownListFor(model => model.Campaign.CampaignType, new SelectList(Model.Types, "key", "value")) 
      @Html.ValidationMessageFor(model => model.Campaign.CampaignType) 
     </div> 
     <p> 
      <input type="submit" value="Create" /> 
     </p> 
    </fieldset> 
} 
<script type="text/javascript"> 
    $('#Campaign_Startdate').datepicker({ 
     dateFormat: "DD, d MM, yy", 
     minDate: new Date() 
    }); 
    $('#Campaign_Enddate').datepicker({ 
     dateFormat: "DD, d MM, yy", 
     minDate: new Date() 
    }); 

</script> 
<div> 
    @Html.ActionLink("Back to List", "Index") 
</div> 




     public class Campaign 
     { 
      #region CTor 
      public Campaign() 
      { 
      } 
      #endregion 

      #region Properties 

      [XmlElement(ElementName = "Id_campaign")] 
      public string ID_Campaign { get; set; } 
      [XmlElement(ElementName = "Campaignname")] 
      public string CampaignName { get; set; } 
      [XmlElement(ElementName = "Websiteurl")] 
      public string WebsiteUrl { get; set; } 
      [XmlElement(ElementName = "Privacypolicyurl")] 
      public string PrivacyPolicyUrl { get; set; } 
      [XmlElement(ElementName = "Termsurl")] 
      public string TermsUrl { get; set; } 
      [XmlElement(ElementName = "Pricepageurl")] 
      public string PricepageUrl { get; set; } 
      [XmlElement(ElementName = "Maxcredit")] 
      public Int32 MaxCredit { get; set; } 
      [XmlElement(ElementName = "Fk_id_currency")] 
      public string FK_ID_Currency { get; set; } 
      [XmlElement(ElementName = "Maxscans")] 
      public short MaxScans { get; set; } 
      [XmlElement(ElementName = "Startdate")] 
      [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:ddd, MMM d, yyyy}")] 
      public DateTime Startdate { get; set; } 
      [XmlElement(ElementName = "Enddate")] 
      [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:ddd, MMM d, yyyy}")] 
      public DateTime Enddate { get; set; } 
      [XmlElement(ElementName = "Starthour")] 
      public short Starthour { get; set; } 
      [XmlElement(ElementName = "Endhour")] 
      public short Endhour { get; set; } 
      [XmlElement(ElementName = "Pmam")] 
      public string PMAM { get; set; } 
      [XmlElement(ElementName = "Language")] 
      public string Language { get; set; } 
      [XmlElement(ElementName = "Fk_id_merchantapp")] 
      public string FK_ID_MerchantApp { get; set; } 
      [XmlElement(ElementName = "Campaigntype")] 
      public string CampaignType { get; set; } 
      [XmlElement(ElementName = "Createtimestamp")] 
      [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:ddd, MMM d, yyyy}")] 
      public DateTime CreateTimestamp { get; set; } 
      [XmlElement(ElementName = "Lastupdate")] 
      [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:ddd, MMM d, yyyy}")] 
      public DateTime LastUpdate { get; set; } 
      [XmlElement(ElementName = "Lastupdateby")] 
      public string LastUpdateBy { get; set; } 
      [XmlElement(ElementName = "Status")] 
      public short Status { get; set; } 
    } 
+0

'제출하지 않음'이라고 말하면 - 브라우저가 전송하지 않는다는 것을 의미합니까 (이 경우 마크 업 문제입니까?)? 또는 서버에서 데이터를 올바르게 읽지 못하고 있습니까? –

+0

"제출"버튼을 클릭해도 아무런 변화가 없습니다. 마크 업 문제라고 생각하지 마십시오. 크롬 F12에서 이의를 제기 할 수 있습니다. – Reinard

+0

그리고 DateFormat을 추가하기 전까지는이 문제가 없었습니다 – Reinard

답변

3

유효성 검사 요약이 true로 설정되어 있습니다. 오류가 특정 입력란에 첨부되어 있지 않으므로 눈에 거슬리지 않는 유효성 검사가 양식 제출을 방해하고 볼 수 없습니까? 어쩌면 거짓으로 설정하려고 시도하고 팝업이 나타나는지 확인하십시오. 고객 확인과 함께 unobtrusive validation turned on이 있습니까?

제출시 HTTP 게시물이 전송되는지 확인하려면 Chrome의 네트워크 도구를 사용 했습니까? 모델에서 "dd/mm/yyyy"를 사용해 보셨습니까?

+0

나를 쏴주세요. 고쳐 주셔서 감사합니다. datepicker는 atm 작업을하지 않고 있지만 무엇이 잘못되었는지 알아낼 것입니다. – Reinard

1

양식이 없습니다. Html.BeginForm에 랩 :

@{ using (Html.BeginForm()) { 




       .... 




    } 
} 
+0

거기에, 그냥 내 질문에, 미안, 복사하지 않았다. – Reinard

1

그것은 너무 분명 들릴 수도 있지만, 당신이 '날짜 선택기'를 추가 한 후 작동을 중지하기 때문에, 당신이 jQuery를 사용하고, 당신이 추가 시도해야

$(document).ready(function() { 

}); 

'datepicker'코드를 래핑합니다.

+0

나는 방금 datepicker 및 DisplayForm과 관련된 모든 것을 제거했으며 양식은 여전히 ​​제출하지 않습니다. 팁 주셔서 감사합니다. – Reinard

관련 문제