struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Musachy Barroso" <musa...@gmail.com>
Subject Re: How to fill a div from an Ajax call when a onchange event is fired ?
Date Thu, 26 Apr 2007 16:28:27 GMT
http://struts.apache.org/2.x/docs/ajax-tags.html

musachy

On 4/26/07, Martin Gainty <mgainty@hotmail.com> wrote:
>
> is there a way to make sure all of these parameters as well as the step by
> step instructions are placed in the docs
> Thanks!
>
> Martin--
> This email message and any files transmitted with it contain confidential
> information intended only for the person(s) to whom this email message is
> addressed.  If you have received this email message in error, please
> notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy.  Thank you.
>
> ----- Original Message -----
> From: "Musachy Barroso" <musachy@gmail.com>
> To: "Struts Users Mailing List" <user@struts.apache.org>
> Sent: Thursday, April 26, 2007 12:05 PM
> Subject: Re: How to fill a div from an Ajax call when a onchange event is
> fired ?
>
>
> > yes, all the values will be sent, but there is a "formFilter" attribute
> > where you can specify a function that will be called for each element,
> and
> > you just need to return true, for the ones that you want to be
> submitted.
> > The function has one parameter, which will be the element.
> >
> > musachy
> >
> > On 4/26/07, Olivier THIERRY <olivier.thierry@gmail.com> wrote:
> >>
> >> Thanks a lot, I can call my action now.
> >>
> >> One more question ...
> >> When I set the formId attribute for the div, does it mean that all
> values
> >> in
> >> the form will be sent to my action ?
> >> If it is the case, is there a way to send only the value of my
> textfield
> >> ?
> >>
> >> Olivier
> >>
> >> 2007/4/26, Musachy Barroso <musachy@gmail.com>:
> >> >
> >> > I think it will be easier (and work) like this:
> >> >
> >> > 1. set href in your div, pointing to your action
> >> > 2. set formId in your div pointing to the form that has the text
> field
> >> > 3. add listenTopic to your div
> >> > 4. publish the topic of 3. when the user types in the textbox
> >> >
> >> > musachy
> >> >
> >> > On 4/26/07, Olivier THIERRY <olivier.thierry@gmail.com> wrote:
> >> > >
> >> > > Hi,
> >> > >
> >> > > I used to use Struts 1.x and I just begin to use Struts 2.x
> >> > > I am very interested with the Ajax feature, but I can't make it
> work
> >> ...
> >> > >
> >> > > What I need to do looks very classical to me :
> >> > > - The user types an employee code in a text box
> >> > > - When the onchange event is fired, I call a Struts action with
> Ajax
> >> > > - This action retrieves the firstname and the name of the employee.
> I
> >> > want
> >> > > these informations to be displayed into a div.
> >> > >
> >> > > I found a similar example in the Struts documentation (bottom of
> this
> >> > page
> >> > > :
> >> > > http://struts.apache.org/2.0.6/docs/ajax-div-template.html ), but
I
> >> > can't
> >> > > make it work ...
> >> > >
> >> > > When the onchange event is fired, I have the following Javascript
> >> error
> >> > :
> >> > >
> >> > > FATAL exception raised: TypeError: infosDemandeurDiv has no
> >> > > properties
> >> > >
> >> > > Could someone tell me what I did wrong, or if there is an easier
> >> method
> >> > to
> >> > > do what I want ?
> >> > >
> >> > > Here is the head section of my jsp :
> >> > >
> >> > > <head>
> >> > >     <title>Demande d'absence</title>
> >> > >     <s:head theme="ajax" debug="true" />
> >> > >     <script type="text/javascript">
> >> > >         function updateInfosDemandeur(matricule) {
> >> > >            var infosDemandeurDiv = window['infosDemandeur'];
> >> > >            infosDemandeurDiv.href =
> >> > > '/../employes/getInfosEmploye.action?matricule='
> >> > > + matricule;
> >> > >            infosDemandeurDiv.bind ();
> >> > >         }
> >> > >         dojo.event.topic.getTopic
> >> > > ("updateInfosDemandeurTopic").subscribe(null,
> >> > > "updateInfosDemandeur");
> >> > >     </script>
> >> > > </head>
> >> > >
> >> > > ... and an extract of the form section ...
> >> > >
> >> > >     <s:form action="submitCreerDemandeAbsence">
> >> > >         <s:textfield     name="demandeAbsence.matriculeDemandeur"
> >> > >                         label="Matricule"
> >> > >                         onchange="
> >> > > dojo.event.topic.publish('updateInfosDemandeurTopic',
> >> > > this.value);" />
> >> > >         <s:div id="infosDemandeur" theme="ajax"
> loadingText="Loading
> >> > > ..."></s:div>
> >> > >         <s:submit type="button" theme="ajax" />
> >> > >     </s:form>
> >> > >
> >> > > Thanks in advance
> >> > >
> >> > > Olivier
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >> >
> >>
> >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message