Search the web
Sign In
New User? Sign Up
flexcoders · RIA Development with Adobe Flex
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
checkbox usage in flex   Message List  
Reply | Forward Message #130907 of 149588 |
RE: [flexcoders] Re: checkbox usage in flex

Yes.  To go a bit further, while you can create the request object declaratively in mxml as you have done, it is dificult to debug and not very flexible. Instead, remove mx:request tagg and do this in a function.  There  is some almost-code below.

 

But, it is not clear from your post quite what you want to sent to the server.  The repeater will produce multiple check boxes.  What is the server expecting?  A delimited list of values?  If so, then Repeater creates an array of references to repeated items that have an id property. You can reference each check box like this: checkBox[n], where “n” is the index in the dataProvider.

 

So, in a for loop, with length equal to the Repeater dataProvider, get a reference to each checkbox.  Build your return data structure as needed.  Then put that into the request object, like below.

 

var oRequest:Object = new Object();

oRequest. strTitle = strTitle.text;

oRequest.strContent = strContent.text;
oRequest.dtmAssignmentDueDate = dtmAssignmentDueDate.text;

//oRequest.selected = See above??;

userRequest.send(oRequest);

 

Now,

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of valdhor
Sent: Friday, November 21, 2008 1:11 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: checkbox usage in flex

 

Instead of initiating send in the button, call a function. In the
function, use the getRepeaterItem method of the repeated item to get
each checkbox value then add that as a parameter of the call.

Check the help for more detail:
http://livedocs.adobe.com/flex/3/html/help.html?content=repeater_3.html

--- In flexcoders@yahoogroups.com, "sbnkn" <sbnkn@...> wrote:
>
> Hi All,
>
> I'm new to Flex development and have strong CF background.
>
> My simple project detail:
> I have a datagrid and a form (text field, textarea field, datefield,
> and checkbox). Once I provide all the information, and submit the
> form, the data gets inserted into the table(SQL DB) and shows in the
> datagrid.
>
> All these work fine except, the checkbox. I use mx:HTTPService.
>
> My question: How do I pass the selected checkbox value(s) to the
> httpservice.
>
> checkbox code:
>
> <mx:Repeater id="checkBoxRepeater"
> dataProvider="{userRequest.lastResult.partners.partner}">
> <mx:CheckBox id="checkBox"
> label="{checkBoxRepeater.currentItem.strPartner}"
> data="{checkBoxRepeater.currentItem.strPartner}"
> />
> </mx:Repeater>
>
> save button code:
> <mx:Button label="Save" click="userRequest.send();cancel();"
> styleName="saveButton"/>
>
> httpservice code:
> <mx:HTTPService id="userRequest"
> url="http://url.com/dispaly/qry_Annoucement.cfm" useProxy="false"
> method="POST">
> <mx:request xmlns="">
> <strTitle>{strTitle.text}</strTitle>
> <strContent>{strContent.text}</strContent>
>
> <dtmAssignmentDueDate>{dtmAssignmentDueDate.text}</dtmAssignmentDueDate>
> <strPartners>{strPartners.text}</strPartners>
> </mx:request>
> </mx:HTTPService>
>
> Any help or direction will be great.
>
> Thanks for your help in advance,
> NB
>



Fri Nov 21, 2008 7:59 pm

nts333rd
Offline Offline
Send Email Send Email

Forward
Message #130907 of 149588 |
Expand Messages Author Sort by Date

Hi All, I'm new to Flex development and have strong CF background. My simple project detail: I have a datagrid and a form (text field, textarea field,...
sbnkn
Offline Send Email
Nov 21, 2008
4:21 am

Instead of initiating send in the button, call a function. In the function, use the getRepeaterItem method of the repeated item to get each checkbox value then...
valdhor
Offline Send Email
Nov 21, 2008
6:11 pm

Yes. To go a bit further, while you can create the request object declaratively in mxml as you have done, it is dificult to debug and not very flexible....
Tracy Spratt
nts333rd
Offline Send Email
Nov 21, 2008
7:42 pm

Hi, Thanks for your suggestions. I tried it and the code looks like this: submit button code: <mx:Button label="Save" click="addAnnouncement(event);cancel();" ...
sbnkn
Offline Send Email
Nov 23, 2008
2:13 pm

At this point I would recommend using an HTTP Debugging Proxy like Charles (http://www.charlesproxy.com) to see exactly what is being sent and where it is...
valdhor
Offline Send Email
Nov 24, 2008
2:12 pm

Ok.I think I found the solution. I removed the method= post from the Httpservice and it did the trick. But I did try the evaluation version. Thanks for all the...
navaneethakrishnan ba...
sbnkn
Offline Send Email
Nov 25, 2008
8:15 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help