When you use a image, instead of using its onclick event , put an href link
on the image and it will work fine.... this is html constraint!!!!

-----Original Message-----
From: Arnaud Heritier [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 11:46 AM
To: 'struts users mailing list'
Subject: RE: <html:image> and javascript incompatibility ???


Sorry, but as you should seen it, I reversed the two JSP codes :-)

arno

-----Message d'origine-----
De:     Arnaud Heritier [SMTP:[EMAIL PROTECTED]]
Date:   jeudi 30 aout 2001 12:40
A:      'struts users mailing list'
Objet:  <html:image> and javascript incompatibility ???

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 : [EMAIL PROTECTED]



------------------------------------------------------------------------------
The information in this Internet email is confidential and may be 
legally privileged. It is intended solely for the addressee. Access 
to this Internet email by anyone else is unauthorised.

If you are not the intended recipient, any disclosure, copying, distribution
or any action taken or omitted to be taken in reliance on it, is prohibited
and may be unlawful. When addressed to our clients any opinions or advice
contained in this Internet email are subject to the terms and conditions
expressed in any applicable governing ING Barings' terms of business or
client engagement letter.

Visit us at www.ingbarings.com

------------------------------------------------------------------------------

Reply via email to