struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arnaud Heritier <aherit...@sopra.com>
Subject RE: <html:image> and javascript incompatibility ???
Date Thu, 30 Aug 2001 13:24:27 GMT
thanx Jonathhan !!

Knowing that my form is in a Page By Page Iterator, I will have to use the "document.forms[the_form_nb].submit()"
method.
It will be the evil :-( Why they don't have invent the "super" property to access the ancestor.
SNIFFFFF.
Thanks for your help, I think I'm on the right way.

arno



-----Message d'origine-----
De:	Jonathan M Crater [SMTP:jonathan_m_crater@fanniemae.com]
Date:	jeudi 30 aout 2001 15:12
A:	struts-user@jakarta.apache.org; Heritier Arnaud
Objet:	Re: <html:image> and javascript incompatibility ???

give the form a name and refer to it like "document.formName.submit()", or
refer to it by its index like "document.forms[0].submit()"

this would be cleaner:

<script language="javascript">
function submitForm(f) {
    if confirm("...") {
        f.submit();
    }
}
</script>

<!-- other code -->

<a href="javascript:submitForm(document.formName)"><img src="..."></a>

Arnaud Heritier wrote:

> ok Fabrice !!!
>
> I made a fault writting the e-mail (I didn't want to add the src :-) ).
> So I put my javascript code in the href property and it's better.
> I'm only staying over a last problem : How to access to the form object in
> which is the <a href=""> to launch the submit from the javascript code?
>
> if I write :
> <html:form action="delSetReq.do">
>             <html:hidden property="name" name="requete"/>
>             <a href="javascript:if(window.confirm('.....'))submit();"><img
> src="img/poubelle.gif" alt="Supprimer"></a>
> </html:form>
>
> the browser (IE5.5) says to me that It missed an object that I think is the
> form on which I would like apply the submit method.
>
> Any idea ????
>
> -----Message d'origine-----
> De:     Fabrice CANTEGREL [SMTP:fcantegrel@fr.reef.com]
> Date:   jeudi 30 aout 2001 14:46
> A:      struts-user@jakarta.apache.org
> Objet:  Re: <html:image> and javascript incompatibility ???
>
> hi Arnaud,
>
> instead of using onClick, just use href="" (not href src="") and put your
> call
> to the javascript in it.
>
> Arnaud Heritier wrote:
>
> > Thanx Satyen for this information.
> >
> > But if I use a
> >
> > <a href src="???" onClick="javascript:validateAndSubmit(????,'....')">
> > <img src="...">
> > </a>
> >
> > What should I use as src because it will go on it when the answer is
> > negative !!! I can put <%=request.getResquestURI()%> but I don't find
> this
> > very beautiful.
> > And how can I access in JavaScript to the form object which is the parent
> > of the <a href="...>???? I don't find how to do.
> >
> > If someone as informations which can help me, I will be very graceful
> !!!!!
> >
> > arno
> >
> > -----Message d'origine-----
> > De:     Satyen.Chikane@ing-barings.com
> [SMTP:Satyen.Chikane@ing-barings.com]
> > Date:   jeudi 30 aout 2001 12:55
> > A:      struts-user@jakarta.apache.org
> > Objet:  RE: <html:image> and javascript incompatibility ???
> >
> > 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:aheritier@sopra.com]
> > 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:aheritier@sopra.com]
> > 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 : aheritier@sopra.com
> >
> > ------------------------------------------------------------------------
> > ------
> > 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
> >
> > ------------------------------------------------------------------------
> > ------
>
> _________________________________________________
>
> CANTEGREL Fabrice
> http://www.reef.com
> _________________________________________________
>
> REEF is a global provider of Internetware for online publishing,
> e-commerce, Web site administration and dynamic asset management.
> _________________________________________________



Mime
View raw message