Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

trouble reading results of checkboxfield and checkboxsetfield.


Go to End


1100 Views

Avatar
vancouverWill

Community Member, 121 Posts

18 January 2011 at 3:10pm

Edited: 20/01/2011 10:48am

trouble reading results of checkboxfield and checkboxsetfield. I'm having an issue with checkboxfield where I can't extract the results from it in the controller and specifically in the form action function. I've used SS a lot over the last couple of years and made lots of forms where using the saveinto function can save all the data at once. Also on templates it easy to call the form variables by using its name and if part of array calling it by parentname.name . However I want to know what it is inside the action function so that I can decide how to finish the function but I can't get it to work. Either I get an index not recognized function or I get nothing at all. I thought this was a basic thing until today and can't see a way to figure it out anywhere.

any ideas?

Thanks

Will

edit: so i've been rechecking the code and I can access the checkbox every time if it is checked but if not checked everything crashes. I'm thinking of either writing some code to see if the checkbox name is included in the returned form array or looking for a thrown Exception. both should work but seems like there must be a quicker way to get this otherwise the SS form engine is just creating more work. not that I don't love SS so no hard feelings ;->