2012-08-28 47 views
0

我有一個窗體,在FF,IE 8,IE 9,鉻提交就好了。Safari,MVC3 ajax表單提交

在safari(窗口)中,它提交,但我的模型是空的。這種行爲只在我的dev和prod網站上,而不是在本地開發。當地發展正常。我在這裏做錯了什麼?

形式:

<form action="/NetSite/Applications/ElectronicFileTransfer" id="TransfersSearchForm" method="post">   
    <table class="siteTable"> 
      <tbody> 
       <tr> 
        <th style="width: 20%;">FICE</th> 
        <td style="width: 80%;"><input id="Criteria_Fice" maxlength="6" name="Criteria.Fice" size="6" type="text" value="" /></td> 
       </tr> 
       <tr> 
        <th>Source Email</th> 
        <td><input id="Criteria_SourceEmail" maxlength="40" name="Criteria.SourceEmail" size="25" type="text" value="" /></td> 
       </tr> 
       <tr> 
        <th>Target Email</th> 
        <td><input id="Criteria_TargetEmail" maxlength="100" name="Criteria.TargetEmail" size="25" type="text" value="" /></td> 
       </tr> 
       <tr> 
        <th>Upload From Date</th> 
        <td> 

      <input class="datePicker" data-val="true" data-val-date="Invalid date specified. Date should be like MM/DD/YYYY." id="Criteria_FromDate" maxlength="12" name="Criteria.FromDate" size="12" type="text" value="" /> 

         <span class="field-validation-valid" data-valmsg-for="Criteria.FromDate" data-valmsg-replace="true"></span> 
        </td> 
       </tr> 
       <tr> 
        <th>Upload To Date</th> 
        <td> 

      <input class="datePicker" data-val="true" data-val-date="Invalid date specified. Date should be like MM/DD/YYYY." id="Criteria_ToDate" maxlength="12" name="Criteria.ToDate" size="12" type="text" value="" /> 

         <span class="field-validation-valid" data-valmsg-for="Criteria.ToDate" data-valmsg-replace="true"></span> 
        </td> 
       </tr> 
       <tr> 
        <th class="empty"></th> 
        <td> 
         <button type="submit" title="Search" id="SubmitButton" class="gradientbutton gradientsmall gradientorange">Search</button>&nbsp; 
         <button type="button" title="Clear" id="ClearButton" class="gradientbutton gradientsmall gradientorange">Reset</button> 
        </td> 
       </tr> 
      </tbody> 
     </table> 
</form> 

JS提交方法,通過該事件被稱爲:

searchFormSubmit: function ($form, currentForm) { 
     if ($form.valid()) { 
      var $button = $("#" + FileTransferHome._enum.SubmitButton); 
      var $searchResults = $("#" + FileTransferHome._enum.SearchResultsDivId); 

      jMessage("Processing request...", $button, true, false); 
      $.ajax({ 
       cache: false, 
       url: currentForm.action, 
       type: currentForm.method, 
       data: $form.serialize(), 
       error: function (xhr, ajaxOptions, thrownError) { 
        jMessageHide(); 
        $searchResults.html(xhr.responseText).addClass(JSGlobalVars.MessageBoxError).fadeIn('slow'); 
       }, 
       success: function (result) { 
        jMessageHide(); 
        $searchResults.removeClass(JSGlobalVars.MessageBoxError).html(result).fadeIn('slow'); 
        location.hash = "SEARCHRESULTS"; 
       } 
      }); 
     } 
    } 

操作:

我在那裏,我已經把有一個else塊只是爲了測試這個情況下,它執行而不是主塊。

[HttpPost] 
public ActionResult Index(ElectronicFileTransferHomeViewModel model) 
{ 
    ... actions... 
} 

enter image description here

+0

你在哪裏有'else'博克?看起來您的Safari瀏覽器配置的文化不同於您的Web服務器,並且您遇到了日期時間格式問題。 –

+0

我已添加圖片顯示所有空值,即使我選擇了項目。我清除了緩存,並且能夠在我的本地開發中複製此內容。 –

+0

@學習:你解決了這個問題嗎?我也有同樣的問題,只在safari瀏覽器。 – clklachu

回答

0

這爲內部應用程序和背後的Windows登錄。 Safari對Windows身份驗證沒有任何問題。 解決這個問題的方法似乎對我們很有幫助(儘管不是很理想)是將Safari置於隱私瀏覽模式。