Reputation: 2497
Hello I want to know if it's possible to add widgets to a CRUD form : I want to select an entry in a list or to enter a text in an input if the entry isn't in list.
The user choose with a radiobutton if he choose in list or write in the input.
It's possible ? If yes, how can I do this ?
Upvotes: 0
Views: 180
Reputation: 5902
I'm not entirely sure if I understand your question correctly.
If you want to add fields to your autogenerated forms you can simply modify the "XxxxForm" class which resides in /lib/forms/XxxxForm.class.php. By adding the following code you can add a radio button:
public function configure()
{
parent::configure();
$this->widgetSchema['myfield'] = new sfWidgetFormInputCheckbox();
$this->validatorSchema['myfield'] = new sfValidatorBoolean(array('required' => 'true'));
}
I hope it helps.
Upvotes: 2
Reputation: 227
Witjh JQuery you can show/hide content. Then if the radiobutton is "list" the list will be showed and the text field hidden and visceversa.
Upvotes: 0