-js
On 9/19/06,
Dan Atkinson <[EMAIL PROTECTED]> wrote:
Actually, there's a problem I didn't count on...
The form is (seemingly) being submitted twice.
When enter is hit, triggering the second button, it still populates the
hidden field, and runs it correctly, but once it's done with that, it goes
back and works on the first button.
This is more of a .NET problem, rather than a JS/jQuery problem, so I'll
leave things here.
Thankyou though, Christian, for your input!
Christian Bach wrote:
>
> Append a hidden input element to the form.
> $("your single form id").append('<input type="hidden"
> name="myserversecret" id="myserversecret"/>');
>
> then append a different value depending on which textarea the user hit
> the "enter" button.
>
> $("#myserversecret").val("I hit enter in the second textearea");
>
> /c
>
>
> Dan Atkinson wrote:
>> Yes, that's a good idea!
>>
>> How/what do you think I could pass something to the server though, to
>> make
>> it know which button was clicked? It doesn't seem to matter which button
>> I
>> run the click function on, it's always the same (first) one.
>>
>>
>> Christian Bach wrote:
>>> I see, i guess i have to pay more attention :)
>>>
>>> OK, how about this.
>>>
>>> var submitType = false;
>>> $("your single form id").submit(function() {
>>> if(submitType == "type1") {
>>> // do something
>>> } else if(submitType == "type2") {
>>> // do something
>>> } else {
>>> return false;
>>> }
>>> });
>>> $("#ctl00_contentPlc_txtPassword").keydown(function(e){
>>> // set type
>>> submitType = "type1";
>>> // fire submit.
>>> $("your single form id").submit();
>>> });
>>> $("#ctl00_contentPlc_txtOtherPassword").keydown(function(e){
>>> // set type
>>> submitType = "type2";
>>> // fire submit.
>>> $("your single form id").submit();
>>> });
>>>
>>> /christian
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
--
View this message in context: http://www.nabble.com/Determine-which-textarea-had-focus-when-%27enter%27-was-pressed.-tf2298484.html#a6387591
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
