Having made this change, when the enter key is pressed the form is
submitted, but I dont want a default submission, I need it to be the
btnSearch
function OKD(){ if (window.event.keyCode == 13 )
{
MultiProjectPicker1_btnSearch.click();
event.returnValue=false;
event.cancel = true; }
}
"tdavisjr" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> This is probably a bug but for some reason asp.net doesn't sent the form
> post variables to the web server if one textbox is on the page. So,
> calling the button click() would actually post the form; but asp.net would
> not run any server side processing since it has no clue on what control
> caused the postback. There is a way around this. You can drop an extra
> textbox on the page and hide it with css. If 2 textboxes are on the page
> then all the form post variables will be sent along with the page and
> calling the click() on the button would actually run the server side code.
> To hide the textbox you can do something like this:
>
> <asp:TextBox runat="server" style="display:hidden;visibility:none;" />
>
> I hope this works.
>
> "Goofy" <(E-Mail Removed)> wrote in message
> news:eNZ#(E-Mail Removed)...
>> Hi everyone,
>>
>> My question is related to making a form submit using javascript. Here is
>> my scenario. I have a form, which includes a user control. The user
>> control has a search button and a submit button. I have visably hidden th
>> search button by setting its appearance and added an HTML button which
>> calls the click event of my real server control button.
>>
>> This works fine.
>>
>> I now want to cause the click event of the search button to be called
>> when the user hits the enter key in the text search text box. I have done
>> this by using the OnKeyDown event of the body tag and check if the
>> character is the enter key. This does invoke the function and I can do an
>> alert('hello world'); to prove it is working.
>>
>> However . . . . . . .
>>
>> If I try and call the real search button click() from this event nothing
>> happens.
>>
>> Does anyone have insight into what I am doing wrong or how I can resolve
>> it.
>>
>> Many Thanks
>>
>>
>>
>>
>>
|