Welcome to WebmasterWorld Guest from 54.80.58.121

Forum Moderators: ocean10000

Message Too Old, No Replies

Forms

     
6:48 pm on Apr 14, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 24, 2005
posts:429
votes: 0


I have two form fields on a page. One is part of the master page in the top header and the other is a login in the center of the page in the page content area. After somebody fills in their username and password and if they don't click the "Sign in" button and hit the enter key on their keyboard instead, it defaults to the search field on the master page and thinks they are trying to search the site.. and no results are found.

Any idea how to rectify this?
Thanks - Hal
7:04 pm on Apr 14, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 15, 2003
posts:2610
votes: 2


Are the <form> tags nested within each other?

<form id="search">

<form id="signup">

</form>
</form>
8:26 pm on Apr 14, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 24, 2005
posts:429
votes: 0


The form on the master page has form tags, the other one doesn't. How do I fix?

The one on master page is like this

<form id="form1" runat="server">
info info..................

</form>
8:38 pm on Apr 14, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 15, 2003
posts:2610
votes: 2


you need to add <form> tags around all the search elements including the submit button

<form id="search_form" method="post" action="/your_search_method">

search box
submit button

</form>

And make sure this form isn't nested within the "master" form
12:10 pm on Apr 15, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 24, 2005
posts:429
votes: 0


This is in ASP.net, not classic asp. The page posts back to itself, no "action" or need to define the "method" as far as I'm aware. Does anybody else have opinions?
2:34 pm on Apr 15, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 12, 2002
posts:1482
votes: 0


You need to set a DefaultButton property for your specific entry areas:

[weblogs.asp.net...]
2:57 pm on Apr 15, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 15, 2003
posts:2610
votes: 2


Oh sorry for taking you the wrong ;)
5:43 pm on Apr 15, 2011 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 17, 2005
posts:5019
votes: 24


ASP.NET or ASP classic, it doesn't matter. Pressing the Enter key will trigger the first submit action within any form. The advice given was correct, you need to have your sign in fields in it's own form element, NOT within your search form.
3:46 pm on Apr 18, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 24, 2005
posts:429
votes: 0


Thanks for the assistance. It is working now.
5:40 pm on Apr 18, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 24, 2005
posts:429
votes: 0


odd.. I spoke too soon. It actually works, and in Firefox looks fine, but in IE, it pushes things around.
2:59 pm on June 17, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 24, 2005
posts:429
votes: 0


Just an update - I found that by placing this on pageload it works


Form.DefaultButton = btnSignin.UniqueID
3:32 pm on June 17, 2011 (gmt 0)

Administrator

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

joined:Jan 14, 2004
posts:864
votes: 3


Thanks for the update on how you manage to solve this problem.

Ocean
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members