RE: javascript delete function wih struts
You will want to change the event on your submit from onclick to onsubmit and modify the set function to return the agree variable (the form will submit if the onsubmit handler returns true). So it will look something like this: function set(target) { var agree = false; agree = confirm("Are you sure you want to delete?"); if ( agree ) { document.forms[0].dispatch.value=target; } return agree; } Delete If you don't change the onclick event handler then your form would always submit, just some times with the dispatch.value set to "delete", other times it would be the default value. BAL From: "Qinjian Jian" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Subject: RE: javascript delete function wih struts Date: Wed, 10 Mar 2004 14:29:48 -0500 Do it like this: function set(target) { var agree = false; agree = confirm("Are you sure you want to delete?"); if ( agree ) { document.forms[0].dispatch.value=target; } } Hope this is helpful Tim Jian -Original Message- From: as as [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 10, 2004 1:55 PM To: Struts Users Mailing List Subject: javascript delete function wih struts Hi I want to show a pop up (delete confirmation in my page) when user clicks on delete button.The pop up will show "Are you sure you want to delte-yes or no" If user clicks on yes, then my page should set a page variable names "dispatch" to "delete".ANd then call my form's post action, which will route it to the next page... how do i accomplish these two tasks for the onlye one button click? Thanks in advance, Sam. My code below: </tt><br> <br> <tt>function set(target) {document.forms[0].dispatch.value=target;}</tt><br> <br> <tt> Delete .. so basically i want a pop up when user clicks the above Delete button (struts uses Thanks in advance for help, Sam. - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Get a FREE online computer virus scan from McAfee when you click here. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: javascript delete function wih struts
Like I said, I'm rusty! :-) Regards, Shahak -Original Message- From: Craig Tataryn [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 10, 2004 2:32 PM To: [EMAIL PROTECTED] Subject: RE: javascript delete function wih struts I think you meant to say: if (window.confirm("Are you sure you want to " + target) == true) Craig On Wed, 10 Mar 2004 14:20:27 -0500, [EMAIL PROTECTED] wrote: > > My JavaScript is rusty, but something along the lines of: > > function set(target) { > > if ("Are you sure you want to " + target) == true) > { > document.forms[0].dispatch.value=target; > document.forms[0].submit(); > } > } > > -Original Message- > From: as as [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 10, 2004 1:55 PM > To: Struts Users Mailing List > Subject: javascript delete function wih struts > > > > Hi > > I want to show a pop up (delete confirmation in my page) when user > clicks on delete button.The pop up will show "Are you sure you want to > delte-yes or no" > If user clicks on yes, then my page should set a page variable names > "dispatch" to "delete".ANd then call my form's post action, which will > route it to the next page... > how do i accomplish these two tasks for the onlye one button click? > Thanks in advance, > Sam. > > My code below: > > > > > > function set(target) {document.forms[0].dispatch.value=target;} > > > > > > > > > > > > Delete > > .. > > > > so basically i want a pop up when user clicks the above Delete button > (struts uses on the yes on this pop up, i want the set(target) to get set > > Thanks in advance for help, > > Sam. > > > > > - > Do you Yahoo!? > Yahoo! SiteBuilder - Free web site building tool. Try it! > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: javascript delete function wih struts
I think you meant to say: if (window.confirm("Are you sure you want to " + target) == true) Craig On Wed, 10 Mar 2004 14:20:27 -0500, [EMAIL PROTECTED] wrote: > > My JavaScript is rusty, but something along the lines of: > > function set(target) { > > if ("Are you sure you want to " + target) == true) > { > document.forms[0].dispatch.value=target; > document.forms[0].submit(); > } > } > > -Original Message- > From: as as [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 10, 2004 1:55 PM > To: Struts Users Mailing List > Subject: javascript delete function wih struts > > > > Hi > > I want to show a pop up (delete confirmation in my page) when user > clicks on delete button.The pop up will show "Are you sure you want to > delte-yes or no" > If user clicks on yes, then my page should set a page variable names > "dispatch" to "delete".ANd then call my form's post action, which will > route it to the next page... > how do i accomplish these two tasks for the onlye one button click? > Thanks in advance, > Sam. > > My code below: > > > > > > function set(target) {document.forms[0].dispatch.value=target;} > > > > > > > > > > > > Delete > > .. > > > > so basically i want a pop up when user clicks the above Delete button > (struts uses on the yes on this pop up, i want the set(target) to get set > > Thanks in advance for help, > > Sam. > > > > > - > Do you Yahoo!? > Yahoo! SiteBuilder - Free web site building tool. Try it! > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: javascript delete function wih struts
Do it like this: function set(target) { var agree = false; agree = confirm("Are you sure you want to delete?"); if ( agree ) { document.forms[0].dispatch.value=target; } } Hope this is helpful Tim Jian -Original Message- From: as as [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 10, 2004 1:55 PM To: Struts Users Mailing List Subject: javascript delete function wih struts Hi I want to show a pop up (delete confirmation in my page) when user clicks on delete button.The pop up will show "Are you sure you want to delte-yes or no" If user clicks on yes, then my page should set a page variable names "dispatch" to "delete".ANd then call my form's post action, which will route it to the next page... how do i accomplish these two tasks for the onlye one button click? Thanks in advance, Sam. My code below: function set(target) {document.forms[0].dispatch.value=target;} Delete .. so basically i want a pop up when user clicks the above Delete button (struts uses
RE: javascript delete function wih struts
My JavaScript is rusty, but something along the lines of: function set(target) { if ("Are you sure you want to " + target) == true) { document.forms[0].dispatch.value=target; document.forms[0].submit(); } } -Original Message- From: as as [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 10, 2004 1:55 PM To: Struts Users Mailing List Subject: javascript delete function wih struts Hi I want to show a pop up (delete confirmation in my page) when user clicks on delete button.The pop up will show "Are you sure you want to delte-yes or no" If user clicks on yes, then my page should set a page variable names "dispatch" to "delete".ANd then call my form's post action, which will route it to the next page... how do i accomplish these two tasks for the onlye one button click? Thanks in advance, Sam. My code below: function set(target) {document.forms[0].dispatch.value=target;} Delete .. so basically i want a pop up when user clicks the above Delete button (struts uses
[OT] RE: javascript delete function wih struts
> From: as as [mailto:[EMAIL PROTECTED] > I want to show a pop up (delete confirmation in my page) when > user clicks on delete button.The pop up will show "Are you > sure you want to delte-yes or no" > If user clicks on yes, then my page should set a page > variable names "dispatch" to "delete".ANd then call my form's > post action, which will route it to the next page... > how do i accomplish these two tasks for the onlye one button click? This is really a JavaScript question, and you'll get far more help in a forum dedicated to that language. But it looks like all you need to do is add: document.forms[0].submit(); inside the ending } of your 'set' function. And perhaps change its name to something more descriptive. This assumes you always want to submit the form, even if they say 'no' to the question. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]