Re: AJAX and WOForm (ERXForm)
Re: AJAX and WOForm (ERXForm)
- Subject: Re: AJAX and WOForm (ERXForm)
- From: Chuck Hill <email@hidden>
- Date: Thu, 12 Feb 2009 16:21:13 -0800
On Feb 11, 2009, at 6:31 PM, John Larson wrote:
Again, I still don't like it, but you made me do it.
:-)
I use this sometimes too and put in ajaxSubmit(this);return false;
instead:
function ajaxSubmit(form){
var numOfElements = form.elements.length;
if (numOfElements > 0) {
for (i=0;i<numOfElements; i++) {
var element = form.elements[i];
if (element.type == "submit") {
element.onclick();
return;
}
}
}
}
It only works if there is one button though, and I think it makes
debugging once more complicated.
The better way to do it is probably to make a new form class that
you bind the ID of the button to and then have it generate the
javascript for the onsubmit binding a la my original post.
A new AjaxForm was one idea. You could even directly add a
defaultAction binding to it instead of using and ID. Another idea
was to add an isDefaultBinding to ASB, and having it set the onSubmit
action of the form when the page was rendered. I'd also considered
catching the Enter and Esc keys so that you could have a submitAction
and a cancelAction (though that is more for the AjaxModalDialog).
Chuck
On Feb 11, 2009, at 8:17 PM, Chuck Hill wrote:
On Feb 11, 2009, at 6:02 PM, John Larson wrote:
I am suffering from a cold and am very tired, so this might not be
what you want, but this is what I do whenever I'm in this very
situation. I put this in the form:
onsubmit="search_button.onclick();return false;"
Replace "search_button" with whatever the id is of your
AjaxUpdateButton. I use it all over the place on IE, Firefox and
Safari and never had a problem.
Yes, that should work. I was aiming for a solution that did not
require custom JavaScript on each form. It is just a question of
how to get the right stuff generated at the right time.
Chuck
On Feb 4, 2009, at 1:18 PM, Chuck Hill wrote:
On Feb 3, 2009, at 10:03 AM, Amedeo Mantica wrote:
Hi,
A simple question...
I have a WOForm with an AjaxSubmitButton that works very
nice,... if the user clicks on the AjaxUpdateButton
I'm getting in trouble in the user hits the return button
because the WOForm does't do an Ajax request.
At the moment I workarounded the problem using the
AjaxUtils.isAjaxRequest method to check the request and return
the response according the request.
How to force wo form submitting an ajax request?
I have been thinking about this too. So far, no good solutions.
I made a DefaultButton that I put first in my regular forms, like
this:
Button: WOImageButton {
action = ^action;
src = "/cadre/images/clear1x1.gif";
tabindex = "";
class = cssClass;
style = ^style;
id = ^id;
}
You then bind this to what you want called when the user hits
Enter. It should be possible to make an Ajax version. It is on
my "To Do" list to find a solution.
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden