Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

need a control to react to form submission even if the submit button not pressed

2 views
Skip to first unread message

Steve

unread,
Jul 14, 2006, 1:06:12 AM7/14/06
to
I'm not sure whether I fix this within the control, or provide some
interface to call it on submit, but anyway...

I have a control which has a text field and a couple of buttons (think
google search form).

The tool's OnClick event is triggered whenever either of the buttons is
pressed (search and All), but not if the user simply pressed enter in
the text field.

I've been looking at the values I get in self.Request.Params, and I can
see that neither button is submitted if I simply press enter. Is there
an easy way to determine either (a) what control caused the submit, or
(b) detect what appears to be an "on Click" of the text field?

I could scan through the Request.Parms structure and detect the case of
there not being either one of the submit buttons there, and then act on
that, but it seems a little brute-forceish.

Steve

Marco Caspers

unread,
Jul 14, 2006, 2:10:10 PM7/14/06
to
Steve wrote:

<snip>



> The tool's OnClick event is triggered whenever either of the buttons
> is pressed (search and All), but not if the user simply pressed enter
> in the text field.

<snip>

The simple method is to choose one of the buttons, and mark it as the
default.
Then if you press the enter key, the action of that button will be
triggered.

--

Unknown

unread,
Jul 14, 2006, 5:28:28 PM7/14/06
to

Another alternative is to handle the OnSubmit event of the <form> tag.

--
Marc Rohloff [TeamB]
marc rohloff -at- myrealbox -dot- com

Steve

unread,
Jul 15, 2006, 1:29:07 AM7/15/06
to
On 15/07/2006 5:28 AM, Marc Rohloff [TeamB] wrote:
> On 14 Jul 2006 11:10:10 -0700, Marco Caspers wrote:
>
>
>> Steve wrote:
>>
>> <snip>
>>
>>
>>> The tool's OnClick event is triggered whenever either of the buttons
>>> is pressed (search and All), but not if the user simply pressed enter
>>> in the text field.
>>>
>> <snip>
>>
>> The simple method is to choose one of the buttons, and mark it as the
>> default.
>> Then if you press the enter key, the action of that button will be
>> triggered.
>>
>
> Another alternative is to handle the OnSubmit event of the <form> tag.
>
>
thanks!

I eventually decided to do some processing in the BeforeRender even of
the object, although I think the default button thing is what I really want.

I've been looking at the form submission side of things and ignoring the
object properties (doh!)

On Submit of the form is another good idea, but less practical for my
application.

So now I have 3 ways to skin this cat.

Steve

Steve

unread,
Jul 17, 2006, 12:49:28 AM7/17/06
to

>>>
>>> The simple method is to choose one of the buttons, and mark it as the
>>> default.

I went looking for this and it seems not to apply to web forms :-(

I couldn't find Default, IsDefault or AcceptButton (the last for the
form). I've been looking at "default button" in the help. There's a
link to a topic "Designating a Windows Form Button as the Accept Button"
but no similar reference to webforms.

In the meantime, the BeforeRender event is working for me.

Steve

0 new messages