Philip Kirkbride
Philip Kirkbride

Reputation: 22889

Change DNN Form into normal GET form

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.

Upvotes: 0

Views: 1067

Answers (2)

Ryan Doom
Ryan Doom

Reputation: 2391

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>

Upvotes: 1

Mitchel Sellers
Mitchel Sellers

Reputation: 63126

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?

Upvotes: 0

Related Questions