You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anurag Garg <an...@nucleussoftware.com> on 2003/06/13 07:27:37 UTC

tag in javascript alert

Hi,

I want to display the validation error message from ActionForm in javascript
alert box, ragther than displaying on my jsp page.
I am doing it in a javascript function at page load time like this,

alert(<html:errors />)

But i am getting the java script error saying "Object expected". Any
solution for this problem..

Thanks,
Anurag Garg


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: tag in javascript alert

Posted by Martin Fekete <fe...@zoznam.sk>.
try this ...

errors.header   =alert(
errors.prefix  ="
errors.suffix  ="+ "\\n" +
errors.footer   ="");\n

...
<script>
    function load() {
        <html:errors />
    }

</script>
...
<body onLoad="load">
...

it should work but it won't because of
http://issues.apache.org/bugzilla/show_bug.cgi?id=17418
so you need to hack org.apache.struts.taglib.html.ErrorsTag

Feky

----- Original Message ----- 
From: "Anurag Garg" <an...@nucleussoftware.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, June 13, 2003 7:27 AM
Subject: <html:errors /> tag in javascript alert


> Hi,
>
> I want to display the validation error message from ActionForm in
javascript
> alert box, ragther than displaying on my jsp page.
> I am doing it in a javascript function at page load time like this,
>
> alert(<html:errors />)
>
> But i am getting the java script error saying "Object expected". Any
> solution for this problem..
>
> Thanks,
> Anurag Garg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org