Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
pear quickform radio buttons with smarty

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
painsek
Smarty n00b


Joined: 17 Jun 2004
Posts: 1

PostPosted: Thu Jun 17, 2004 3:20 pm    Post subject: pear quickform radio buttons with smarty Reply with quote

Hello all!!
I started a website, I am using a framework with phplib DB for the database library, PEAR Quickform for the form validation, and Smarty for the templates.Twisted Evil

I have made a form that I render with Pear's HTML_QuickForm_Renderer_ArraySmarty()

Into this form I wanted to put a "what is your sex" radio element. From the doc, I see that I must create 2 radio elements, with the same ID:

the php code is:

$form->addElement('radio', 'sex', '<b>You are </b>...', 'a woman', 2);
$form->addElement('radio', 'sex', '<b>You are </b>...', 'a man', 1);


So the user can only select one of the two options.

and the template code is, as usual:
{$form_data.sex.label}
{$form_data.sex.html}


I must add that I use several other Quickform elements in this form, and they work perfect, but this radio element doesn't produce anything (no HTML is generated)

So I must have made a mistake in my radio element definition, but I can't find which one!!!Confused

Can anyone help me?
Thanks a lot Wink
Back to top
View user's profile Send private message
Sal
Smarty n00b


Joined: 06 Oct 2004
Posts: 1

PostPosted: Wed Oct 06, 2004 9:15 pm    Post subject: Reply with quote

Yea, I am having the same problem, I know it has something to do with a foreach loop, i just dont know how to write it out.

how someone can help.

-- Sal
Back to top
View user's profile Send private message
dan.klasson
Smarty n00b


Joined: 17 Apr 2011
Posts: 3

PostPosted: Sun Apr 17, 2011 3:27 pm    Post subject: Reply with quote

In your case, since the last parameters you pass are integers:

{$form_data.sex.1.label}
{$form_data.sex.1.html}

{$form_data.sex.2.label}
{$form_data.sex.2.html}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP