You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ryan webb <we...@gmail.com> on 2008/03/12 08:28:04 UTC
how to add simple javascript with struts? simple example please...
Hi everyone!
I just want to know how to insert javascripts in a struts page?
here's my version but not working..=(
<html:html locale="true">
<head>
<title>JSP page</title>
<script type="text/javascript">
function confirmation(){
confirm("Are you sure to update?");
}
</script>
</head>
<body>
<html:form action="update.do" method="POST">
<html:submit onclick="confirmation()" value="Update">
</html:form>
</body>
</html:html>
In my test page works fine, however...(sad part) I am expecting a pop up
window message that confirms if I want to update or not.
but it just proceeds with the action (*.do)
Any suggestions?
God bless,
Ryan Webb -- Philippines
Re: how to add simple javascript with struts? simple example please...
Posted by ryan webb <we...@gmail.com>.
Hi bugs,
thanks I will try your suggestion! =)
God bless,
Ryan Webb -- Philippines
On Wed, Mar 12, 2008 at 7:26 PM, bugs_ <bu...@centrum.cz> wrote:
>
> <%@ taglib uri="/tags/struts-html" prefix="html" %>
> <html:html locale="true">
> <head>
> <title>JSP page</title>
> <script type="text/javascript">
> function confirmation(){
> return confirm("Are you sure to update?");
> }
> </script>
> </head>
> <body>
> <html:form action="/basic" method="POST" >
> <html:submit onclick="javascript: return confirmation()"
> value="Update" />
> </html:form>
> </body>
> </html:html>
>
> This should work. If you have more submit buttons you can use <html:form
> onsubmit="... instead of <html:submit onclick="...
>
>
>
>
> ryan webb-2 wrote:
> >
> > Hi everyone!
> >
> > I just want to know how to insert javascripts in a struts page?
> >
> > here's my version but not working..=(
> > <html:html locale="true">
> > <head>
> > <title>JSP page</title>
> > <script type="text/javascript">
> > function confirmation(){
> > confirm("Are you sure to update?");
> > }
> > </script>
> > </head>
> > <body>
> > <html:form action="update.do" method="POST">
> > <html:submit onclick="confirmation()" value="Update">
> > </html:form>
> > </body>
> > </html:html>
> >
> > In my test page works fine, however...(sad part) I am expecting a pop up
> > window message that confirms if I want to update or not.
> > but it just proceeds with the action (*.do)
> >
> > Any suggestions?
> >
> > God bless,
> > Ryan Webb -- Philippines
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/how-to-add-simple-javascript-with-struts--simple-example-please...-tp15999324p16001759.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: how to add simple javascript with struts? simple example
please...
Posted by bugs_ <bu...@centrum.cz>.
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<html:html locale="true">
<head>
<title>JSP page</title>
<script type="text/javascript">
function confirmation(){
return confirm("Are you sure to update?");
}
</script>
</head>
<body>
<html:form action="/basic" method="POST" >
<html:submit onclick="javascript: return confirmation()"
value="Update" />
</html:form>
</body>
</html:html>
This should work. If you have more submit buttons you can use <html:form
onsubmit="... instead of <html:submit onclick="...
ryan webb-2 wrote:
>
> Hi everyone!
>
> I just want to know how to insert javascripts in a struts page?
>
> here's my version but not working..=(
> <html:html locale="true">
> <head>
> <title>JSP page</title>
> <script type="text/javascript">
> function confirmation(){
> confirm("Are you sure to update?");
> }
> </script>
> </head>
> <body>
> <html:form action="update.do" method="POST">
> <html:submit onclick="confirmation()" value="Update">
> </html:form>
> </body>
> </html:html>
>
> In my test page works fine, however...(sad part) I am expecting a pop up
> window message that confirms if I want to update or not.
> but it just proceeds with the action (*.do)
>
> Any suggestions?
>
> God bless,
> Ryan Webb -- Philippines
>
>
--
View this message in context: http://www.nabble.com/how-to-add-simple-javascript-with-struts--simple-example-please...-tp15999324p16001759.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org