Get Widget default field value with invoke method/controller in Kentico 13 ?

Kaur Navneet asked on March 27, 2023 09:28

I have created a User based form in Kentico 13 and Also created the Admin form in the CMS that has some default values to its widget properties. I want to use the field values from the Admin form in my MVC code at the controller level. My query here is, How exactly I can get those widget property values from the Form I've created in the CMS?

Recent Answers


Trevor Fayas answered on March 27, 2023 19:37

That would be tricky, you would have to query the CMS_Class table, find your form, parse the XML of the ClassFormDefinition field to find the default value (or if it's an alternative form, in the CMS_AlternativeForm - FormDefinition). Probably not worth it tbh.

If you really MUST have the default value shared between Admin/MVC, may want to consider a site setting then in the admin using the {% SiteSetting["DefaultUserFieldName"] %} for the default value, and the SettingsKeyInfoProvider for the mvc side.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.