November Happy Hour will be moved to Thursday December 5th.

Make forced field dependent on choice on another

Vote:
 

I've got two custom properties (both dropdowns) in my page type and I'd like to make the second one forced (value must be entered) if a certain value is selected in the first one. Any ideas on how to do this?

#52896
Aug 18, 2011 15:51
Vote:
 

Easiest would be to create a custom property that uses both of these custom properties and add the necessary validation logic based on that. Another approach is using FindControl method to find the other property and inject the necessary validation based on the value (could also use PropertySettings for this).

Hope this helps.

Frederik

#52897
Aug 18, 2011 16:33
Vote:
 

I need to be able to use them seperately so perhaps the FindControl would be the easiest way to do it then. Thanks!

#52898
Aug 18, 2011 16:35
Vote:
 

Here is a post about validation in custom properties: http://world.episerver.com/Blogs/Linus-Ekstrom/Dates/2008/10/Validation-of-property-values/, might be easier for you to hook into the Save page event and add the validation logic there (see http://blog.bigfinger.se/2010/4/26/simple-validation-of-propertyvalues-in-episerver-cms-6.aspx for an example).

Good luck!

Frederik

#52899
Aug 18, 2011 16:44
Vote:
 

That save page event was great advice. Thank you!!

#52907
Aug 19, 2011 9:56
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.