struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arnaud Heritier <aherit...@sopra.com>
Subject <html:image> and javascript incompatibility ???
Date Thu, 30 Aug 2001 10:40:19 GMT
Hello Guys!!

I've a little problem concerning the use of the html taglib and the javascript code.
I'm not sure that it concerns directly the html taglib or the html language itself.

The problem is that I would like to propose to the user to confirm an action before to do
it.
I had written this javascript function :

function validateAndSubmit(theform,warningtext) {
    if (window.confirm(warningtext)) {
	alert('ok')
	theform.submit()
	return true
    } else {
	alert('not ok')
	return false
    }
}
and this JSP code :

<html:form action="delSetReq.do">
	<html:hidden 
		property="name" 
		name="requete"/>
	<html:image 
		src="img/poubelle.gif" 
		alt="Supprimer" 
		onclick="javascript:validateAndSubmit(this.form,'Etes-vous certain de vouloir supprimer
cette requete de recherche de lots?')"/>
</html:form>


and it's WORK.
When I don't confirm nothing happends, whereas when I confirm the action executes.

So, now I would like to replace this button by an image.
I keep the same javascript code
and I replace the JSP by this one :

<html:form action="delSetReq.do">
	<html:hidden 
		property="name" 
		name="requete"/>
	<html:button 
		property="button" 
		onclick="javascript:validateAndSubmit(this.form,'Etes-vous certain de vouloir supprimer
cette requete de recherche de lots?')">
		Supprimer
	</html:button>
</html:form>

Now in both cases (if I confirm or not), the action is called, but I get the good alert message
from the javascript !!!!!!

I don't understand what it happends !!!!!

Is anyone have an idea concerning my problem.

Thanx all

arno

PS : my configuration is :
OS : NT 4 SP6
WebApp Server : Tomcat 3.2.3
Browser : IE5.5
and Struts 1.0

Arnaud HERITIER
Ingenieur d'etudes
SOPRA. Group
EAI Consulting
Tel : +33-1-49-00-58-12
Fax : 04 50 33 30 78
Email : aheritier@sopra.com



Mime
View raw message