问题
I have textinput within list itemrenderer like
main.mxml
<s:List
id="videoAttachmentsList"
itemRenderer.normalView="com.engage.discussion.attachment.renderers.VideoAttachmentRenderer"
>
<mx:button label="add" click=addevent(Event) />
VideoAttachmentRenderer.as
<TextInput styleName="commonTextInput"
prompt="Enter a video header"
id="headerText"
x="75" width="185" height="21"
bottom="5"
fontSize="10"
maxChars="30"/>
<fx:Declarations>
<mx:StringValidator source="{headerText}" property="text" required="true" maxLength="30" requiredFieldError="Please enter video header"/>
</fx:Declarations>
My doubts is when i click add button on (main.mxml) that time need validate headerText(Textinput)(VideoAttachmentRenderer.as) . is it possible to validate string withing itemRenderer. could u give any guidance ?
回答1:
override the set data method and trigger the validation in there
来源:https://stackoverflow.com/questions/4992369/how-to-validate-textinput-within-itemrenderer