17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2252 Views |
-
Forms again :-)

21 November 2006 at 2:11pm
Hi!
I'm wondering how exactly to implement radio buttons, check boxes and select/option items inside form that is added through pagetype? I'm looking into source code for these items but i'm still not clear how to use them (and a few experiments failed
).
So simple code example (maybe to add this to the docs directly) for these would be really apreciated.
10x
-
Re: Forms again :-)

22 November 2006 at 2:49pm Last edited: 22 November 2006 2:50pm
Heya, I've created a simple recipe for creating and adding some of these form fields to your form.
http://doc.silverstripe.com/doku.php?id=forms
and
http://doc.silverstripe.com/doku.php?id=ss2:forms:recipes
Naming each form element the same as the objects static $db variable will automatically save them to the object when you run $form->saveInto($object) from your form action.
Let me know if this helps
-
Re: Forms again :-)

24 November 2006 at 3:25am
Can you please give me example how to create group of radio buttons on a form and group of checkboxes. Real code example, if possible. I'm still little lost on that. I managed to get form up and running but I need those elements.
10x in advance!
-
Re: Forms again :-)

24 November 2006 at 9:48am
I've added an example to the optionsetfield page, which is the form field you use to create a set of radio buttons.
The constructor is the same as a dropdown, so you pretty much just pass it a name, title and a array of source values.
See this link for more information.
http://doc.silverstripe.com/doku.php?id=optionsetfield
| 2252 Views | ||
|
Page:
1
|
Go to Top |


