2012-09-08 44 views
0

我正在使用boxy jquery插件來顯示我的模態形式。 http://onehackoranother.com/projects/jquery/boxy/Boxy模態插件返回按鈕表單提交後再次顯示

在我產卵包含在提交給自己這樣一個形式的模式頁:

<script type='text/javascript'> 
    $(function() { 
     $('.boxy').boxy({modal: true, closeText: '', draggable: false, unloadOnHide:  true}); 
    }); 
</script> 

<div class="reportPop hiddenContent" id="reportPop"> 
    <form action="" method="post" name="reportContent"> 
     <p><?php echo $t_report_content_message_text; ?></p> 
     <br /> 
     <input type="hidden" value="<?php echo $post->ID ?>" name="reported_item_id" /> 
     <input type="hidden" value="Question" name="reported_type" /> 
     <input type="hidden" value="<?php echo $post->ID; ?>" name="question_id" /> 
     <input type="hidden" value="1" name="report_content" /> 
     <input type="submit" value="<?php echo $t_report_question;?>" /> 
    </form> 
    <div class="clear"></div> 
</div> 

我都爲形式的工作功能提交,但一旦我提交表單和嘗試使用後退按鈕,它再次顯示模式,而不是所需的體驗。在沒有打開模式的情況下,只看到頁面。

任何想法?

+0

你可以把你的JavaScript – Sender

+0

剛剛添加的四四方方的調用JS代碼 – estern

回答

0

我猜hidding形式提交表單將解決你的問題 試試這個代碼,請在:

<script type='text/javascript'> 
    $(function() { 
     $('.boxy').boxy({modal: true, closeText: '', draggable: false, unloadOnHide:  true}); 
     $('#myForm').submit(function(){ 
      var self = $(this); 
      $('#reportPop').hide("normal",function(){ 
       self.submit(); 
      }); 
      return false; 
     }); 
    }); 
</script> 

<div class="reportPop hiddenContent" id="reportPop"> 
    <form id="myForm" action="" method="post" name="reportContent"> 
     <p><?php echo $t_report_content_message_text; ?></p> 
     <br /> 
     <input type="hidden" value="<?php echo $post->ID ?>" name="reported_item_id" /> 
     <input type="hidden" value="Question" name="reported_type" /> 
     <input type="hidden" value="<?php echo $post->ID; ?>" name="question_id" /> 
     <input type="hidden" value="1" name="report_content" /> 
     <input type="submit" value="<?php echo $t_report_question;?>" /> 
    </form> 
    <div class="clear"></div> 
</div> 
+0

這並沒有解決問題後退按鈕 – estern

+0

如果您使用上面的代碼,那麼模式會在每次訪問此頁時顯示!是這樣嗎? – webNeat

+0

不,只有在鏈接被點擊以顯示具有方形類的模式時纔會顯示。這個問題只發生在我提交表單然後點擊後退按鈕 – estern