----- Original Message -----
From: "Bruce McKenzie" <[EMAIL PROTECTED]>
To: "Jonathan Mangin" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Tuesday, November 21, 2006 4:22 PM
Subject: Re: [cgiapp] Returning multiple values with CGI::Ajax
> Maybe I'm misreading what's you're trying to do, but if the user changes
> the date in one form, why not just distribute that value to the other
> two formfields with Javascript? You could do this with a CGI::Ajax
> callback if you wanted to have the server check the date first.
I thought that's what I was trying (see examples below).
The only thing I've been able to do is chain two functions
together (onblur="newDate(['date'],['form2_date']);newDate
(['date'],['form3_date']);"). Maybe a problem with TT?
But you gave me a clue...I don't need to check the date or
anything else server-side, so I wrote my own javascript
function. Wasn't as hard as I thought.
Thanks,
Jon
> I don't
> think CGI::Ajax was intended to deal with the multiple elements in the
> DOM, except via JavaScript.
>
> Bruce
>
>
> Jonathan Mangin wrote:
> > Hi all,
> >
> > Here's another semi-OT CGI::Ajax question. Hoping someone has
> > solved this with CGI::Application. I have three forms on
> > a page. Form1 has a date field. In one of my run modes, if
> > the user changes that date, I want to replace hidden fields
> > in the other two forms with the new date. I'm sending one
> > element and (hopefully) returning two to distinct divs.
> >
> > In the run mode:
> > my $pjx = new CGI::Ajax('selected_date' => 'test.pl?rm=selected_date');
> > # $pjx->DEBUG(1);
> > # $pjx->JSDEBUG(1);
> > my $ajax_js = $pjx->show_javascript();
> >
> > In the template:
> > [% IF ajax_js %]
> > <input class=text type=text id=date name=date size=11 maxlength=10
> > value=[% i_row.0 %] onblur="selected_date(['date'], ['form2_date',
> > form3_date']);">
> > [% ELSE %]
> > <input class=text type=text name=date size=11 maxlength=10 value=[%
> > i_row.0 %]>
> > [% END %]
> >
> > The sub:
> > sub selected_date {
> > my $self = shift;
> > my $q = $self->query();
> > my $date = $q->param('date');
> >
> > my $form2 = "<input type=hidden name=date value=$date>";
> > my $form3 = "<input type=hidden name=date value=$date>";
> >
> > return ($form2, $form3);
> > }
> >
> > <div id=form3_date> always displays 'undefined' so I'm not sure
> > where this is going wrong. <form2_date> is populated correctly.
> > Does anyone see anything obviously wrong?
> >
> > Thanks,
> > Jon
> >
> >
> >
> > ---------------------------------------------------------------------
> > Web Archive: http://www.mail-archive.com/[email protected]/
> > http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> Web Archive: http://www.mail-archive.com/[email protected]/
> http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]