1794 Posts in 590 Topics by 562 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1421 Views |
-
CheckboxField not validating with RequiredFields

2 October 2009 at 6:21am Last edited: 2 October 2009 6:22am
Hi,
Before I start to use jquery for form validation, I wonder if I could user RequiredFields to check if a CheckboxField is selected .
The next code is not validating the CheckboxField :function SubscriptionForm() {
$condition =FormPage::ConditionDetails();
$url = $condition->URLSegment;
$fields = new FieldSet(
new HiddenField("Subject", "Subject", $this->CF_Title),
new TextField("Name", "Naam"),
new CheckboxField("CheckThis","Ckeck this box")
);$actions = new FieldSet(
new FormAction('SendSubscriptionForm', 'Send')
);$validator = new RequiredFields('Name','CheckThis');
$form = new Form($this, "SubscriptionForm", $fields, $actions, $validator);
return $form;
}Seems ok, but maybe i missed something.
Thanks in advance..
-
Re: CheckboxField not validating with RequiredFields

2 October 2009 at 4:30pm
RequiredFields needs to be passed an array of fieldnames, not a string
new RequiredFields(array('Name', 'CheckThis'));
-
Re: CheckboxField not validating with RequiredFields

3 October 2009 at 12:25am
You replied before I edited the post, but you were right about the typo.
I noticed that the checkboxes do validate serverside after form submission, but not onClick with the Textfields.
However, I can live with it for the moment...
| 1421 Views | ||
|
Page:
1
|
Go to Top |


