Custom Clone

Joshua Adams asked on December 26, 2014 22:21

I have a custom class that I am having to clone through code. Oddly enough, there is something that is making the name field into a codename, and I don't see where to control this. Because of this, my code for the clone fails, unless I take the name and take out all of the spaces and special characters, which I don't want to have to do because it should not be a codename. I have rebuilt the controlling class definition, and I don't see any property on the field that would make it a code name, as it uses the normal textbox form control with no validation rules. Could there be another place that this is managed?

Thanks in advance

Recent Answers


Roman Hutnyk answered on December 27, 2014 04:35

Try ValidationHelper.GetCodeName(string) method, if I'm not mistaken. You can find more methods @ http://devnet.kentico.com/docs/8_0/api/html/AllMembers_T_CMS_Helpers_ValidationHelper.htm

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on December 29, 2014 14:55

The problem is that I don't want it to have to be a codename. I want it to behave like a normal textbox/string value. I am not sure whats causing it to try to validate it against a code name.

0 votesVote for this answer Mark as a Correct answer

Filip Ligač answered on February 1, 2015 14:08 (last edited on February 1, 2015 14:08)

Hello Josh,

Is it a class belonging to a custom module or simply a page type?

If you were talking about a certain page type, you can check whether the field is not accidentally selected as a Page name source field in Page types -> (your page type) -> Fields -> Page name source field on the left side.

Best regards,

Filip

0 votesVote for this answer Mark as a Correct answer

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