<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Validating Flex forms using the Validator classes</title>
	<link>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Tue, 06 Jan 2009 00:44:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: Aasim</title>
		<link>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-14556</link>
		<author>Aasim</author>
		<pubDate>Fri, 08 Aug 2008 09:23:28 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-14556</guid>
		<description>I guess what Tanya wanted to point was that the ComboBox control is validated on creation. The solution to her query can be achieved by setting the triggerEvent on the validator to "focusOut" of the source.

This would trigger the validation of the comboBox on moving focus from the comboBox.

code below--

&lt;pre class="code"&gt;
&#60;mx:NumberValidator id="comboValidator" required="true" minValue="0" 
    	invalid="changeComboBorder(event)" valid="changeComboBorder(event)"
    	triggerEvent="focusOut"
    	source="{trialCombo}" property="selectedIndex" /&#62;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I guess what Tanya wanted to point was that the ComboBox control is validated on creation. The solution to her query can be achieved by setting the triggerEvent on the validator to &#8220;focusOut&#8221; of the source.</p>
<p>This would trigger the validation of the comboBox on moving focus from the comboBox.</p>
<p>code below&#8211;</p>
<pre class="code">
&lt;mx:NumberValidator id="comboValidator" required="true" minValue="0"
    	invalid="changeComboBorder(event)" valid="changeComboBorder(event)"
    	triggerEvent="focusOut"
    	source="{trialCombo}" property="selectedIndex" /&gt;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate R</title>
		<link>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-13849</link>
		<author>Nate R</author>
		<pubDate>Tue, 01 Jul 2008 20:44:53 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-13849</guid>
		<description>Tanya,

Here is what I did to get the ComboBox's border to show as red when invalid.
&lt;pre class="code"&gt;
&#60;mx:NumberValidator id="validator" source="{combo}" property="selectedIndex" minValue="0" invalid="changeComboBorder(event)" valid="changeComboBorder(event)" /&#62;

private function changeComboBorder(event:ValidationResultEvent):void {
  var validator:Validator = event.target as Validator;
  var comboBox:ComboBox = validator.source as ComboBox;
			
  if (event.type == ValidationResultEvent.VALID) {
    comboBox.setStyle("borderColor", 0xB7BABC);
  }
  else {
    comboBox.setStyle("borderColor", 0xFF0000);
  }
}
&lt;/pre&gt;

Hopefully this helps.</description>
		<content:encoded><![CDATA[<p>Tanya,</p>
<p>Here is what I did to get the ComboBox&#8217;s border to show as red when invalid.</p>
<pre class="code">
&lt;mx:NumberValidator id="validator" source="{combo}" property="selectedIndex" minValue="0" invalid="changeComboBorder(event)" valid="changeComboBorder(event)" /&gt;

private function changeComboBorder(event:ValidationResultEvent):void {
  var validator:Validator = event.target as Validator;
  var comboBox:ComboBox = validator.source as ComboBox;

  if (event.type == ValidationResultEvent.VALID) {
    comboBox.setStyle("borderColor", 0xB7BABC);
  }
  else {
    comboBox.setStyle("borderColor", 0xFF0000);
  }
}
</pre>
<p>Hopefully this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tanya R</title>
		<link>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-13661</link>
		<author>Tanya R</author>
		<pubDate>Wed, 25 Jun 2008 20:29:48 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-13661</guid>
		<description>oh oh, the code didn't show... but i hope you get the main idea of my issue.

Thanks!</description>
		<content:encoded><![CDATA[<p>oh oh, the code didn&#8217;t show&#8230; but i hope you get the main idea of my issue.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tanya R</title>
		<link>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-13660</link>
		<author>Tanya R</author>
		<pubDate>Wed, 25 Jun 2008 20:29:03 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-13660</guid>
		<description>Great Examples.

i have a quesiton about combobox, it seems that when the page first loads, my comboboxes are marked as invalid right away, even before the submit button is clicked.

In your sample however, they do not have the red border around them initially.... is there a way to fix it?

this is a snippit of my code:

[code]
		
			
		
[/code]


and

[code]

	

[/code]


please help me, i can't seem to find a solution to this anywere.


Thanks!
-Tanya</description>
		<content:encoded><![CDATA[<p>Great Examples.</p>
<p>i have a quesiton about combobox, it seems that when the page first loads, my comboboxes are marked as invalid right away, even before the submit button is clicked.</p>
<p>In your sample however, they do not have the red border around them initially&#8230;. is there a way to fix it?</p>
<p>this is a snippit of my code:</p>
<p>[code]</p>
<p>[/code]</p>
<p>and</p>
<p>[code]</p>
<p>[/code]</p>
<p>please help me, i can&#8217;t seem to find a solution to this anywere.</p>
<p>Thanks!<br />
-Tanya</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: flexlingie</title>
		<link>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-13528</link>
		<author>flexlingie</author>
		<pubDate>Thu, 19 Jun 2008 22:01:06 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-13528</guid>
		<description>Great blog posting. I like the idea of a BooleanValidator!
Thanks!</description>
		<content:encoded><![CDATA[<p>Great blog posting. I like the idea of a BooleanValidator!<br />
Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: دردشة</title>
		<link>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-12308</link>
		<author>دردشة</author>
		<pubDate>Sat, 26 Apr 2008 15:11:21 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-12308</guid>
		<description>the type of credit card being validated</description>
		<content:encoded><![CDATA[<p>the type of credit card being validated</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Halfway there...</title>
		<link>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-7775</link>
		<author>Halfway there...</author>
		<pubDate>Fri, 21 Mar 2008 21:10:34 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-7775</guid>
		<description>Sorry, but this is not a good example. Way too much boilerplate code and no reusability. It's also missing some of the instant error feedback (indicate after each keystroke whether your form input is valid or invalid - come on, javascript forms can do this...) or even basic expected functionality such as having the enter key "revalidate" the input component or something.

What if you have 10 forms with 5-20 fields each? Are we supposed to copy and paste all that stuff for every field, every form? It's not easily pulled out into a custom component.

Nice for simple cases but serious apps will demand more than this...</description>
		<content:encoded><![CDATA[<p>Sorry, but this is not a good example. Way too much boilerplate code and no reusability. It&#8217;s also missing some of the instant error feedback (indicate after each keystroke whether your form input is valid or invalid - come on, javascript forms can do this&#8230;) or even basic expected functionality such as having the enter key &#8220;revalidate&#8221; the input component or something.</p>
<p>What if you have 10 forms with 5-20 fields each? Are we supposed to copy and paste all that stuff for every field, every form? It&#8217;s not easily pulled out into a custom component.</p>
<p>Nice for simple cases but serious apps will demand more than this&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gareth</title>
		<link>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-3776</link>
		<author>Gareth</author>
		<pubDate>Thu, 01 Nov 2007 20:34:16 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-3776</guid>
		<description>Hey Peter,
finally got around to this post again.  Thanks for the post.  That definitely makes it easier to understand.  I guess what confused me previously was that the object would be the source and the properties for each would be the the actual properties of the object.  I'm not sure what it was I was trying, but whatever I was doing was not working.  This will definitely help.
Thanks.</description>
		<content:encoded><![CDATA[<p>Hey Peter,<br />
finally got around to this post again.  Thanks for the post.  That definitely makes it easier to understand.  I guess what confused me previously was that the object would be the source and the properties for each would be the the actual properties of the object.  I&#8217;m not sure what it was I was trying, but whatever I was doing was not working.  This will definitely help.<br />
Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-3502</link>
		<author>peterd</author>
		<pubDate>Sat, 20 Oct 2007 06:30:37 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-3502</guid>
		<description>Gareth,

I just whipped this up (&lt;a href="http://blog.flexexamples.com/2007/10/19/creating-a-credit-card-validator-in-actionscript/" rel="nofollow"&gt;"Creating a credit card validator in ActionScript"&lt;/a&gt;), although now re-reading your question I'm not sure if I answered the right thing.

Was that roughly what you were looking for? Or were you looking for something more specific to the object syntax?

Peter</description>
		<content:encoded><![CDATA[<p>Gareth,</p>
<p>I just whipped this up (<a href="http://blog.flexexamples.com/2007/10/19/creating-a-credit-card-validator-in-actionscript/" rel="nofollow">&#8220;Creating a credit card validator in ActionScript&#8221;</a>), although now re-reading your question I&#8217;m not sure if I answered the right thing.</p>
<p>Was that roughly what you were looking for? Or were you looking for something more specific to the object syntax?</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gareth</title>
		<link>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-3501</link>
		<author>Gareth</author>
		<pubDate>Sat, 20 Oct 2007 02:24:20 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/08/13/validating-flex-forms-using-the-validator-classes/#comment-3501</guid>
		<description>Does anyone know how to use the source and property fields to do a credit card validation in actionscript?  I know that I can use the cardTypeSource and property and the cardNumberSource and property to do it, but I'm trying to make it more generic, and, according to the livedocs, it is possible by passing an object.  However, I've tried just about every variation I can think of, but none of them work.

This is the part that's confusing me

Use the source and property properties to specify a single Object. The Object should contain the following fields:

cardType - Specifies the type of credit card being validated.
In MXML, use the values: "American Express", "Diners Club", "Discover", "MasterCard", or "Visa".
In ActionScript, use the static constants CreditCardValidatorCardType.MASTER_CARD, CreditCardValidatorCardType.VISA, or CreditCardValidatorCardType.AMERICAN_EXPRESS CreditCardValidatorCardType.DISCOVER, or CreditCardValidatorCardType.DINERS_CLUB.

cardNumber - Specifies the number of the card being validated.

I've done ccObj:object = { cardNumber: myCardNumField, cardType: myCardTypeField }
for the source, but then I don't know what string to use for the property (as property appears that it has to be a string).

Anyone have any ideas?</description>
		<content:encoded><![CDATA[<p>Does anyone know how to use the source and property fields to do a credit card validation in actionscript?  I know that I can use the cardTypeSource and property and the cardNumberSource and property to do it, but I&#8217;m trying to make it more generic, and, according to the livedocs, it is possible by passing an object.  However, I&#8217;ve tried just about every variation I can think of, but none of them work.</p>
<p>This is the part that&#8217;s confusing me</p>
<p>Use the source and property properties to specify a single Object. The Object should contain the following fields:</p>
<p>cardType - Specifies the type of credit card being validated.<br />
In MXML, use the values: &#8220;American Express&#8221;, &#8220;Diners Club&#8221;, &#8220;Discover&#8221;, &#8220;MasterCard&#8221;, or &#8220;Visa&#8221;.<br />
In ActionScript, use the static constants CreditCardValidatorCardType.MASTER_CARD, CreditCardValidatorCardType.VISA, or CreditCardValidatorCardType.AMERICAN_EXPRESS CreditCardValidatorCardType.DISCOVER, or CreditCardValidatorCardType.DINERS_CLUB.</p>
<p>cardNumber - Specifies the number of the card being validated.</p>
<p>I&#8217;ve done ccObj:object = { cardNumber: myCardNumField, cardType: myCardTypeField }<br />
for the source, but then I don&#8217;t know what string to use for the property (as property appears that it has to be a string).</p>
<p>Anyone have any ideas?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
