Re: [htmltmpl] Problems with HTML::TEMPLATE
Brought to you by:
samtregar
From: Rama S. <ra...@sa...> - 2005-03-17 03:15:51
|
Hello all, Thanks for the feed back. I had to specifically mention CHECKED="CHECKED" in the if statement to make it work. Simply by saying CHECKED alone (though a valid html attribute) does not seem to work. Basically to be more clear I tried doing this first <input type="radio" name="beepStatus" value="yes" <tmpl_if yesBeeps>cheecked</tmpl_if> it did not work. but by doing this it worked <input type="radio" name="beepStatus" value="yes" <tmpl_if yesBeeps>cheecked="checked"</tmpl_if> worked out well. I am guessing the html template engine must be looking for some name-value pairs and just by seeing a single value with out a matching name would have rejected interpreting it. Thanks to all and special thanks to simonartist. rama ----- Original Message ----- From: "Justin Simoni" <ju...@sk...> To: "Rama Srinivas" <ra...@sa...> Cc: <htm...@li...> Sent: Wednesday, March 16, 2005 2:28 PM Subject: Re: [htmltmpl] Problems with HTML::TEMPLATE I usually do something like this: <input type="radio" name="beepStatus" value="yes" <tmpl_if yesBeeps>checked="checked"</tmpl_if> /> Where, "yesBeeps" holds 1 or undefined. I guess your perl code would look something like: my $yesBeeps = 0; $yesBeeps = 1 if beepStatus eq "yes"; $tmpl_obj->param(yesBeeps => $yesBeeps); You may also want to look at HTML::FillinForm, which is a real time saver. If you have a large form with many form elements, HTML::Template gets a bit unwieldy: http://search.cpan.org/~tjmather/HTML-FillInForm-1.05/lib/HTML/ FillInForm.pm That way, you can pass HTML::FillnForm the value of, "beepStatus", and if there's a radiobutton that's associated with that value, it'll get checked. Like *magic*. I preprocess an HTML page with HTML::Template, and then give it to HTML::FillinForm to fill in the holes. Works really well. Saves me 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 > > I am reading information from a DB and prepopulating my form fields. > I am using HTML:TEMPLATES module to process my html tmpl files > > Some of the entries in my table are radio buttons. I am prepopulating > them but for some reason they donot seem to be prepopulated. I tried > to do a view page source to see if the html is properly generated. It > seems to do so. > All the other form fields are working fine. except radio buttons. > > IS there any known issue with radio buttons prepopulation when using > html tempalates. > > Here is the snippet of the code in my tmpl file. > > <td>Beeps: yes: > <input type="radio" name="beepStatus" value="yes" <TMPL_VAR > NAME="yesBeeps"> > > </td> > > The yesBeeps param displays checked or is empty string depending if > that radio button has to be prepopulated or not. But suprising even if > 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 > printing html doc through my perl program > thanks > rama |