You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Barbara Post <ba...@ifrance.com> on 2002/07/11 09:34:52 UTC

struts and javascript document.write(...)

Hello, I am playing with this :

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg16093.html

but have troubles with document.write(...) in a .js file that does not write
on my jsp but on a new page. guess I have all the javascript functions to be
in .jsp files ? (see the link above).

Thanks for any clue,

Babs


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: struts and javascript document.write(...)

Posted by Virga <vi...@mytravelsoft.com>.
hi babs,
you could also use 'innerHTML', but it will not work in 'not-so-dhtml'
browser like netscape 4.7.x :-(
e.g.:
create a function to display the error message and call the function on your
validation script.
<script language="Javascript">
function displayError(theMessage) {
        document.getElementById('error').innerHTML = theMessage;
}
function validateForm (theForm) {
       var error = false;
       if (theForm.username.value == "") error = true;
       if (error ) {
          displayError ('put your name please');
          return false;
       }
      else return true;
}
</script>
put id on <td> or <div> in your jsp page where you want to display it.
e.g.:
<tr><td id="error">&nbsp;</td></tr>
and......put onsubmit="return validateForm(this);" on your <form> tag.

hope it'll help

VR




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: struts and javascript document.write(...)

Posted by Barbara Post <ba...@ifrance.com>.
thanks Adarsh, so what's the workaround to add some content with a
javascript on a jsp ?

Babs
----- Original Message -----
From: Adarsh <ad...@patni.com>
To: Struts Users Mailing List <st...@jakarta.apache.org>
Sent: Thursday, July 11, 2002 10:26 AM
Subject: RE: struts and javascript document.write(...)


> hi
> documnt.write always erase the contents and starts as new
>
> -----Original Message-----
> From: Barbara Post [mailto:babs33@ifrance.com]
> Sent: Thursday, July 11, 2002 1:05 PM
> To: struts-user@jakarta.apache.org
> Subject: struts and javascript document.write(...)
>
>
> Hello, I am playing with this :
>
> http://www.mail-archive.com/struts-user@jakarta.apache.org/msg16093.html
>
> but have troubles with document.write(...) in a .js file that does not
write
> on my jsp but on a new page. guess I have all the javascript functions to
be
> in .jsp files ? (see the link above).
>
> Thanks for any clue,
>
> Babs
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: struts and javascript document.write(...)

Posted by Adarsh <ad...@patni.com>.
hi
documnt.write always erase the contents and starts as new

-----Original Message-----
From: Barbara Post [mailto:babs33@ifrance.com]
Sent: Thursday, July 11, 2002 1:05 PM
To: struts-user@jakarta.apache.org
Subject: struts and javascript document.write(...)


Hello, I am playing with this :

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg16093.html

but have troubles with document.write(...) in a .js file that does not write
on my jsp but on a new page. guess I have all the javascript functions to be
in .jsp files ? (see the link above).

Thanks for any clue,

Babs


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>