Re: [htmltmpl] Problems with HTML::TEMPLATE
Brought to you by:
samtregar
From: Justin S. <ju...@sk...> - 2005-03-16 22:28:39
|
I usually do something like this: <input type=3D"radio" name=3D"beepStatus" value=3D"yes"=A0 = <tmpl_if =20 yesBeeps>checked=3D"checked"</tmpl_if> /> Where, "yesBeeps" holds 1 or undefined. I guess your perl code would =20 look something like: my $yesBeeps =3D 0; $yesBeeps =3D 1 if beepStatus eq "yes"; $tmpl_obj->param(yesBeeps =3D> $yesBeeps); You may also want to look at HTML::FillinForm, which is a real time =20 saver. If you have a large form with many form elements, HTML::Template =20= gets a bit unwieldy: =09 http://search.cpan.org/~tjmather/HTML-FillInForm-1.05/lib/HTML/=20= FillInForm.pm That way, you can pass HTML::FillnForm the value of, "beepStatus", and =20= if there's a radiobutton that's associated with that value, it'll get =20= checked. Like *magic*. I preprocess an HTML page with HTML::Template, and then give it to =20 HTML::FillinForm to fill in the holes. Works really well. Saves me =20 time. Makes me look like a supehero. Cheers, justinSimoni.Artist -- .: art http://justinsimoni.com .: phone 720 436 7701 On Mar 16, 2005, at 9:29 AM, Rama Srinivas wrote: > Hi > =A0 > I am reading information from a DB and prepopulating my=A0form = fields.=A0 > I am using HTML:TEMPLATES module to process my html tmpl files > =A0 > Some of the entries in my table are radio buttons. I am prepopulating =20= > them but for some reason they donot seem to be prepopulated. I tried =20= > to do a view page source to see if the html is properly generated. It =20= > seems to do so. > All the other form fields are working fine. except radio buttons. > =A0 > IS there any known issue with radio buttons prepopulation when using =20= > html tempalates. > =A0 > Here is the snippet of the code in my tmpl file. > =A0 > <td>Beeps: yes: > <input type=3D"radio" name=3D"beepStatus" value=3D"yes"=A0 <TMPL_VAR =20= > NAME=3D"yesBeeps"> > > </td> > =A0 > The yesBeeps param displays checked or is empty string depending if =20= > that radio button has to be prepopulated or not. But suprising even if = =20 > it is marked as checked it does not show that in my html page. > Any help or hints would help. Or i need to switch to the old style of =20= > printing html doc through my perl program > thanks > rama |