/**
* Wireup textboxes to its default button
*
* e: event passed on from the textbox
* element: default button (input button)
*/
DefaultButton : function(event, element) {
if (!this.isObject(event)) this.Print("DefaultButton(event,
element): argument (0) [e] must be of type object");
if (!this.isStringOrObject(element))
this.Print("DefaultButton(event, element): argument (1) [element] must
be of type string or object");
if (this.isString(element)) element = $(element);
Event.element(event).blur();
Event.element(event).focus();
if ((event.which && event.which == 13) || (event.keyCode &&
event.keyCode == 13)) {
event.returnValue = false;
event.cancel = true;
element.click();
return false;
} else {
return true;
}
}
On Aug 25, 6:56 am, PhotoShopGod <[EMAIL PROTECTED]> wrote:
> I have just started using prototype and love it. I have already
> completed several apps in short time. I do have one question that I
> have been unable to find an answer for. I have a handful of forms and
> would like to submit the forms using the return key and to not have
> them always use there mouse. I guess I'm looking for proper
> impemantation using prototype. Does anyone have an example that I
> could see? Below is one of my basic forms with only one field.
>
> <script type="text/javascript" language="JavaScript">
> function checkDate() {
> var q = document.getElementById('wedDate').value;
> new Ajax.Request("AJAXProcessor.asp", {
> method: 'post',
> parameters: 'page=CheckDate&q=' + q,
> onCreate : displayLoading("dateResult"),
> onComplete: function (req) {
> if (req.responseText != "") {
>
> document.getElementById("dateResult").innerHTML=req.responseText;
> }
> }
>
> });
>
> }
>
> </script>
>
> Any help would be appreciated.
>
> Marty
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---