<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; subField</title>
	<atom:link href="http://blog.flexexamples.com/tag/subfield/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Validating strings using the StringValidator class</title>
		<link>http://blog.flexexamples.com/2008/03/13/validating-strings-using-the-stringvalidator-class/</link>
		<comments>http://blog.flexexamples.com/2008/03/13/validating-strings-using-the-stringvalidator-class/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 06:53:41 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[StringValidator]]></category>
		<category><![CDATA[Validators]]></category>
		<category><![CDATA[errorCode]]></category>
		<category><![CDATA[errorMessage]]></category>
		<category><![CDATA[isError]]></category>
		<category><![CDATA[subField]]></category>
		<category><![CDATA[validateString()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/03/13/validating-strings-using-the-stringvalidator-class/</guid>
		<description><![CDATA[<p>The following example shows how you can validate strings using the static StringValidator.validateString() method.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/03/13/validating-strings-using-the-stringvalidator-class/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.utils.ObjectUtil; import mx.controls.Alert; private function doValidate(value:String):void { var arr:Array = StringValidator.validateString(stringValidator, value); textArea.text = ObjectUtil.toString(arr); dataGrid.dataProvider = arr; if (arr.length == [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can validate strings using the static <code>StringValidator.validateString()</code> method.</p>
<p>Full code after the jump.</p>
<p><span id="more-554"></span></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/03/13/validating-strings-using-the-stringvalidator-class/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.utils.ObjectUtil;
            import mx.controls.Alert;

            private function doValidate(value:String):void {
                var arr:Array = StringValidator.validateString(stringValidator, value);
                textArea.text = ObjectUtil.toString(arr);
                dataGrid.dataProvider = arr;
                if (arr.length == 0) {
                    Alert.show("String is valid.");
                }
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:StringValidator id="stringValidator"
            minLength="3"
            maxLength="6" /&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:TextInput id="textInput" /&gt;
        &lt;mx:Button label="validate"
                click="doValidate(textInput.text);" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:TabNavigator id="tabNavigator"
            creationPolicy="all"
            width="100%"
            height="100%"&gt;
        &lt;mx:VBox label="Grid"
                width="100%"
                height="100%"&gt;
            &lt;mx:DataGrid id="dataGrid"
                    variableRowHeight="true"
                    width="100%"
                    height="100%"&gt;
                &lt;mx:columns&gt;
                    &lt;mx:DataGridColumn dataField="errorCode" /&gt;
                    &lt;mx:DataGridColumn dataField="errorMessage"
                            wordWrap="true" /&gt;
                    &lt;mx:DataGridColumn dataField="isError" /&gt;
                    &lt;mx:DataGridColumn dataField="subField" /&gt;
                &lt;/mx:columns&gt;
            &lt;/mx:DataGrid&gt;
        &lt;/mx:VBox&gt;
        &lt;mx:VBox label="Text"
                width="100%"
                height="100%"&gt;
            &lt;mx:TextArea id="textArea"
                    editable="false"
                    width="100%"
                    height="100%" /&gt;
        &lt;/mx:VBox&gt;
    &lt;/mx:TabNavigator&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Validating strings using the StringValidator class on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/03/13/validating-strings-using-the-stringvalidator-class/',contentID: 'post-554',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'errorCode,errorMessage,isError,subField,validateString()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/03/13/validating-strings-using-the-stringvalidator-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

