Re: Problems with HTML::TEMPLATE

Justin Simoni <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <[email protected]>
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



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.