Building a form with radio buttons?
Hey there,
A friend told me about this cms and It looks great. I've been messing around trying to make my company's store application as a module, but i'm stuck at this part where I need to display a form with radio buttons. I don't see it listed as a type for the form_builder class. Is there a way to do this or can I still use CI's form_helper?
Thanks,
-Justin
Comments
For more on hooks, look at the bottom of this page:
http://www.getfuelcms.com/user_guide/libraries/my_model
Let me know if that helps.
[code]
$config['layout_fields']['my_page'] = array(
'content' => array('type' => 'textarea', 'description' => 'Body text'),
'comments' => array('description' => 'Allow comments on this page?', 'type' => 'enum', 'options' => array('yes' => 'yes', 'no' => 'no')),
);
[/code]
Works fine.
To add to Lance's comment, there is an additional parameter of 'mode' you can pass and you can give it a value of 'radios' which will force the enum to be radio inputs instead of a select. You will get a select if you have more then 2 values and the 'mode' value is set to 'auto'. Also, the Form_builder class has a property of single_select_mode which will set the default way to handle enum form fields. For more on the Form_builder class visit:
http://www.getfuelcms.com/user_guide/libraries/form_builder
Hope that helps.
I want to have them list vertically and the next form I'll need to include another column for a flash player.
Is it possible to extend the form_builder class and overwrite the render_table function so I can make a custom table for these forms?
Thanks,
-Justin
The code (for an enum) is The html that is actually being generated is I thought that the keys in the options array were the values (similar to the form_class examples), but apparently not. The values, labels, and text all appear to be identical. Is there no way to have them differ from the values? I also don't see any way to get "selected" onto any of these options.
A similar issue is occurring with type=multi --- and in the case of multi, I need to be able to get "selected" onto multiple options.
Am I screwing it up, or is something amiss here?
Do I need to rewrite using the form class and not use the form_builder?
Thanks.
The only form builder examples on this forum or in the documentation actually do have the keys and values identical -- it is possible that I'm the first to try to use it with them not being the same?