Solved

RadioButtonGroup validation

Posted on 2009-04-14
8
2,825 Views
Last Modified: 2012-05-06
I get the error:

Error #1069: Property selectedItem not found on mx.controls.RadioButtonGroup and there is no default value.

Flex doesn't seem to have anything specific for radio buttons. So how would I handle this? The default value for report.attended = -1


<mx:NumberValidator source="{attended}" property="selectedItem" allowNegative="false"/>

 

<mx:FormItem required="true" verticalGap="0" enabled="{editMode}">

	<mx:RadioButtonGroup id="attended" selectedValue="{report.attended}"/>

	<mx:RadioButton groupName="attended" label="Yes"  value="1"/>

	<mx:RadioButton groupName="attended" label="No"  value="0"/>

</mx:FormItem>

Open in new window

0
Comment
Question by:hallikpapa
  • 4
  • 4
8 Comments
 
LVL 5

Expert Comment

by:Fuzzy_Logic_
ID: 24143219
change:

 property="selectedItem"

to

 property="value"

Although I can't see why you need a NumberValidator since the value will either be 1 or 0.
0
 
LVL 5

Accepted Solution

by:
Fuzzy_Logic_ earned 500 total points
ID: 24143252
sorry that should be

property="selectedValue"
0
 

Author Comment

by:hallikpapa
ID: 24143277
I added just that one validator, and I got "cannot access null property or reference"

I don't need numbervalidator, just trying different options
0
 
LVL 5

Expert Comment

by:Fuzzy_Logic_
ID: 24143558
see amendment above.
0
Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

 

Author Comment

by:hallikpapa
ID: 24144266
Sorry, I should have included I entered selectedValue
0
 

Author Comment

by:hallikpapa
ID: 24148193
This is what it looks like now, and it still gives me an error:
private function _validate():void

{

        if(Validator.validateAll(promoCodeValidators).length > 0)

	{

		var err:ValidationResultEvent;

        var errorMessageArray:Array = [];

        var validatorErrorArray:Array = Validator.validateAll(promoCodeValidators);

        for each (err in validatorErrorArray) 

        {

            //ERROR HERE ONLY FOR THE RADIO BUTTON GROUP

            var errField:String = FormItem(err.currentTarget.source.parent).label

            errorMessageArray.push("* " + errField); 

        }

        Alert.show(errorMessageArray.join("\n"), "The following required fields must be completed before submission:", Alert.OK);

        coversheetShow = false;

		return;

	}

}
 
 

<mx:FormItem required="true" verticalGap="0" enabled="{editMode}">

	<mx:RadioButtonGroup id="attended" selectedValue="{report.attended}"/>

	<mx:RadioButton groupName="attended" label="Yes" value="1" />

	<mx:RadioButton groupName="attended" label="No" value="0" />

</mx:FormItem>
 

<mx:StringValidator source="{attended}" property="selectedValue" required="true"/>

Open in new window

0
 
LVL 5

Expert Comment

by:Fuzzy_Logic_
ID: 24149984
the error is thrown, I believe, because report.attended is null.

If you were to enter a number instead, the code would work.

You need to make sure report.attended has a value.
0
 

Author Comment

by:hallikpapa
ID: 24150049
the default value for report (ReportVO) is -1

I will do some further investigation, but you are probably right.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
: Microsoft Office Collaborate for free and online versions of Microsoft  Word, Excel, Powerpoint, OneNote, Onedrive , Email, Calendar etc. In short we can say that Microsoft office is a suite of servers, applications and services developed by  Micr…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now