Jump to content

Validate input for FieldtypeOptions


chrizz
 Share

Recommended Posts

I was wondering if there's an easy way to validate if a title is a valid value for a FieldtypeOptions field. 

I have created a field with different status values where only a single value can be selected:
 

1=done
2=planned
3=error

Now I am going to update the page which includes this field which works fine so far - but: I I am using any other string than the defined options it stores a blank value. To avoid this I am trying to validate the input before. Something like getAllOptionsForField > in_array() etc would work but maybe there's a build-in method I am currently missing? 

Long story short: how would you validate if the given string is a valid option for a field?

as usual: Thanks :)

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...