Validating the SingleImagePlaceholderControl
The technique for validating a SingleImagePlaceholderControl
is similar to that of the HtmlPlaceholderControl
. We first need to find a way to read its contents using client-side script. Once we have the content, we can proceed to check to see if it is valid. If it isn’t, we cancel the save.
Let’s build a required SingleImagePlaceholderControl
validator. In this example, we will program the validator to verify that the author has uploaded a picture to the control.
Retrieving the Value of the SingleImagePlaceholderControl
The SingleImagePlaceholderControl
is rendered on the browser as a series of hidden form fields and images organized neatly within tables.
Here’s a snippet of the generated code:
. . . code continues . . .
<input type="hidden" value="" name="NCPH_ImagePlaceholderDefinitionName"
placeholderType="singleImage" /><input type="hidden" value="" name="NCPHHRef_
ImagePlaceholderDefinitionName"/>
<input type="hidden" value=""...