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:[EMAIL PROTECTED] 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
<http://livedocs.adobe.com/flex/3/html/help.html?content=repeater_3.html
> 

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "sbnkn" <[EMAIL PROTECTED]> 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
<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
>

 

Reply via email to