Change DNN Form into normal GET form

允我心安 提交于 2019-12-12 04:08:24

问题


I'm working on making some changes to a Dot Net Nuke website with a customized skin. I found out that the header to the skins file was located in 'Default.aspx' here.

The form has some very strange behavior. I have had to disable the enter button because pressing within the form causes the webpage to go to "/HOME.aspx" however that action is never specified within the Default.aspx.

The code is as follows.

    <dnn:Form id="Form" runat="server" ENCTYPE="multipart/form-data" >
    <asp:Label ID="SkinError" runat="server" CssClass="NormalRed" Visible="False"></asp:Label>
    <asp:PlaceHolder ID="SkinPlaceHolder" runat="server" />
    <input id="ScrollTop" runat="server" name="ScrollTop" type="hidden" />
    <input id="__dnnVariable" runat="server" name="__dnnVariable" type="hidden" />
</dnn:Form>

The form after being processed displays in the browser as.

<form name="Form" method="post" action="/HOME.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="Form" enctype="multipart/form-data">

What I want the code to display as is simply.

<form name="Form" method="get" action="/SearchResults.aspx"  id="Form">

I tried removing the dnn code with the html directly but removing the dnn form causes the website to crash.


EDIT

What I'm trying to do can be seen at http://www.ontariosheep.org Notice if you press the button the search works but pressing enter causes the page to refresh.


回答1:


You can use some Javascript to do this:

jQuery('#SearchBox').keypress(function(e){
   if(e.which == 13){
       e.preventDefault();CallSearchPage('http://www.ontariosheep.org/SearchResults.aspx');
   }
});

You would need to put that in script tags and also in a jQuery document ready area... like

<script> jQuery(document).ready(function(){

//code above here

}); </script>




回答2:


Changing the behavior of the form in DNN is not something you are going to do easily. DNN uses the ASP.NET Web Forms model, so the action for the page is always the current page.

If you want to customize this the only real way is to modify the form action via JavaScript on a specific page, but note that doing that prior to a button click or similar trigger WILL break all administration functions on the page that require a postback to the server.

What are you trying to accomplish?



来源:https://stackoverflow.com/questions/10432692/change-dnn-form-into-normal-get-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!