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:
Sent: Friday, November 21, 2008
1:11 PM
To:
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.
--- In flexcoders@yahoogro
>
> 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="checkBoxRepeate
> dataProvider=
> <mx:CheckBox id="checkBox"
> label="{checkBoxRep
> data="{checkBoxRepe
> />
> </mx:Repeater>
>
> save button code:
> <mx:Button label="Save" click="userRequest.
> styleName="saveButt
>
> httpservice code:
> <mx:HTTPService id="userRequest"
> url="http://url.com/
> method="POST"
> <mx:request xmlns="">
> <strTitle>{strTitle
> <strContent>
>
> <dtmAssignmentDueDa
> <strPartners>
> </mx:request>
> </mx:HTTPService>
>
> Any help or direction will be great.
>
> Thanks for your help in advance,
> NB
>