I have made a custom form control based on the country selector that includes a zip code which appears and/or is required depending on what country is selected. I added it to the control like so:
<cms:CMSTextBox ID="zipCodeTextBox" runat="server" />
Then in the OnPreRender I try to set the class of the control and also add the watermark like so:
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
//other code left out that determines if zip should be required here
zipCodeTextBox.WatermarkText = "test";
zipCodeTextBox.CssClass = "required TextBoxField";
The class gets set successfully as the country drop down is changed (I can see the style of the input change) and no errors occur, but no watermark appears either when zip code is required. Am I missing something? Is this not the write place to put the code (onPreRender)? Is something more required to make watermark work? Or can it just not be set in code like this?
Thanks,
Matt