You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mike Bungay <MB...@sciss.com> on 2001/10/02 16:17:53 UTC
Can an action be cancelled once the submit button is clicked.
This question is to anyone that can possibly help me. I have a jsp form
that is running 3 actions, these actions are managed by JavaScript (i.e. if
delete is pressed the action is changed to delete.do, etc.).
My question: Is there anyway to stop an action from running (continuing)
in the JavaScript?? i.e. if a record is not selected I want to stop the
action from occuring instead of it running my default action.
Question 2: I am also wondering if there is anyway to capture
the success mapping in the jsp to trigger another event?? i.e. on the
success of the delete.do action I want to refresh the window that opened the
delete.jsp page.
Question 3: Does any know of any combo box field either in
struts or in html that I can use??
Thanks everyone,
Mike
Re: Can an action be cancelled once the submit button is clicked.
Posted by Peter Alfors <pe...@hksystems.com>.
Mike Bungay wrote:
> This question is to anyone that can possibly help me. I have a jsp form
> that is running 3 actions, these actions are managed by JavaScript (i.e. if
> delete is pressed the action is changed to delete.do, etc.).
>
> My question: Is there anyway to stop an action from running (continuing)
> in the JavaScript?? i.e. if a record is not selected I want to stop the
> action from occuring instead of it running my default action.
>
You could use javascript to validate that the necessary field(s) are filled in
before executing the form submit.
Once the form is submitted, the page no longer has control, therefore, you
cannot stop the action processing once it has begun. However, if you can verify
that there is a problem in your action class, you can exit early. Not sure if
that helps you.
>
> Question 2: I am also wondering if there is anyway to capture
> the success mapping in the jsp to trigger another event?? i.e. on the
> success of the delete.do action I want to refresh the window that opened the
> delete.jsp page.
>
Are you opening the delete.do in another window? If so, you can use javascript
in the new window to ask the window.opener to reload itself. If the delete.do
action is successful, forward to a page that performs this javascript.
Otherwise, forward to some error page.
If you are executing the delete.do in the current window, then you will be
leaving the current page, and therefore is a moot point.
>
> Question 3: Does any know of any combo box field either in
> struts or in html that I can use??
>
There is no such thing as a combo box (where you can select from a list or type
into the field). This is an HTML limitation.
>
> Thanks everyone,
>
> Mike
HTH,
Pete