Radio Button binding to XML

Based on the examples
here
and
here
I have a datagrid which uses an XML object as its dataprovider. The
xml goes like this:
<questions>
<question>
<prompt>What are your heroes?</prompt>
<answers>
<answer>
<correct>true</correct>
<text>Luther Higgs</text>
</answer>
<answer>
<correct>false</correct>
<text>Barney Fife</text>
</answer>
</answers>
</question>
</questions>
Well formed (if a bit confusing) xml. In my datagrid I have
two columns. The second column binds to
questions.question.answers.answer.text and works just fine. The
datagrid's editable property is set to true, and I'm able to click
on the second colum and type and it saves the answer back into the
xml object just fine. The problem lies in my first column. The mxml
looks like this:
<mx:DataGridColumn headerText="Correct">
<mx:itemRenderer>
<mx:Component>
<mx:VBox horizontalAlign="center">
<mx:RadioButton id="myRadioButton"
buttonMode="true" useHandCursor="true"
group="{outerDocument.myRadioButtonGroup}"
selected="{data.correct}"/>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
The problem is that the radio buttons' selected properties
aren't bound to the xml, that is the one that is true doesn't
display as selected. If I set the datagridcolumn's editable
property to false, clicking on the radio button doesn't affect the
xml at all either. If I leave the editable property of the
datagridcolumn as the inherited default of true (based on the
parent datagrid's editable property) when I click on the radio
button the default itemEditor appears (a text input box) which
contains the following text:
</answer>
and when I leave the editor (click outside or hit enter) the
xml then looks like this:
<answers>
<answer>
<correct>true</correct>
<text>Luther Higgs</text>
</answer>
<answer>
<correct>false</correct>
<text>Barney Fife</text>
<null>&lt;answer&gt;
&lt;correct&gt;false&lt;/correct&gt;
&lt;text&gt;Barney Fife&lt;/text&gt;
&lt;/answer&gt;</null>
</answer>
</answers>
I have seen controls that don't have the xml path written
correctly display the entire xml node rather than just the
contained data, but I can think of no reason anything should Ever
reference just the closing tag. To me this looks like a bug in the
data bindings between the radio button and the xml object.
Just to clear the air to avoid suggestions that will work but
not meet the design requirements, what I need is a datagrid that
has a radio button group (only one correct answer out of the group)
in the first column and strings in the second column which need to
be editable. I suppose I could write some hairy event listener code
and manually hack things together, but aside from avoiding that
headache, I'd love to use data bindings for what they were intended
for - I just need to know why it doesn't appear to be working
right. Much thanks in advance for any and all help.

Searching the LiveDocs revealed the answer. Under the topic
"Using an E4X expression in an <mx:Binding> tag" I found that
if instead of
<mx:RadioButton id="myRadioButton"
buttonMode="true" useHandCursor="true"
group="{outerDocument.myRadioButtonGroup}"
selected="{data.correct}"/>
I have
<mx:RadioButton id="myRadioButton"
buttonMode="true" useHandCursor="true"
group="{outerDocument.myRadioButtonGroup}"/>
<mx:Binding source="myRadioButton.selected"
destination="data.correct" />
It works just perfectly.
Apparently binding between XML and the selected property of a
radio button (which is of type boolean) needs the <mx:Binding
/> rather than the in-tag curly brace notation.
P.S. The link on livedocs is here:
http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Live Docs_Book_Parts&file=databinding_091_05.html#177459

Similar Messages

  • Radio Button of two columns to be grouped

    Dear Experts,
    I have a table with columns like SUBSCRIBE and UNSUBSCRIBE which are wdy_boolean data type and displaying as radio buttons.
    The problem is both columns are displaying as selected and want to make these two columns as group so only one can be selected.
    I mapped cell variant with other column but its not hit.
    Please suggest.
    Thanks & Regrads
    Siva Mandapudi.

    Hello Siva,
    To achieve this functionality do the following
    1. Create one context attribute by name 'selectedValue' ( type string) under the context node of the table
    2. create two columns in the table with name SUBSCRIBE and UNSUBSCRIBE (as you did already). let the cell editor be RadioButton. Cell variants are  not required
    3. Now for the SUBSCRIBE radio button, bind the 'selectedKey' property to 'selectedValue' context attribute. And maintain the 'KeyToSelect' property as 'SUBSCRIBE'
    4. for the UNSUBSCRIBE radio button, bind the 'selectedKey' property to 'selectedValue' context attribute. And maintain the 'KeyToSelect' property as 'UNSUBSCRIBE'
    so whenever the user selects a radiobutton, corresondinf values SUBSCRIBE or UNSUBSCRIBE will be stored in the selectedValue context attribute.
    Hope this helps. you can refer the following article for more details
    [http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/d0aba847-ff58-2c10-4a98-c0fad334c5aa]
    BR, Saravanan

  • Radio Buttons - returning individual values from an exclusion group possible?

    Using LC Designer 7.1
    Does anyone know if it is possible to return individual values from an exclusion group of radio buttons?  My xml data file gives one value for the entire group, e.g.,
    2
    ...where the second radio button was selected.  But I'd prefer an output something like this...
      0
      1
      0
    etc...
    Is something in this format possible?

    You might be better off to use checkboxes and script them to act like radio buttons (as an exclusion group). That way they'd each have an on/off value.
    Regards,
    Dave

  • Radio Button Data Binding

    Hi All,
    I am a vb beginner and I was wondering how you bind a radio button to a field in a database that has choice of 2 values. For example the field in my db is CoverType and the user should be able to select Hardcover or Paperback.
    Don't seem to be able to do get radio buttons to represent this on my form.
    Thanks very much 

    Hi Colin,
    I'm having the same trouble, and although I work in 'Classic' HTML & Vb this might be useful for you.
    I found that with Radio Buttons, you can bind each one in a group to the same DataSrc & DataFld.  Since all the Radios have the same Name and ID they switch between as usual, however, each radio has a different Value which is updated into the XML.
    <xml ID=ERRI>  
    <ROOT> 
    <RATE> 
    <RATE1></RATE1>  
    </RATE> 
    </ROOT> 
    </xml> 
    <Table DataSrc=#ERRI DataFld=RATE>  
    <tr><Td colspan=5><b>Rate This</b></td></tr> 
    <Tr><Td><Input DataSrc=#ERRI DataFld=RATE.RATE1 Value="1" Type=Radio id=Radio1 name=Radio1></Td><td>1</td></Tr>  
    <Tr><Td><Input DataSrc=#ERRI DataFld=RATE.RATE1 Value="2" Type=Radio id=Radio1 name=Radio1></Td><td>2</td></Tr>  
    <Tr><Td><Input DataSrc=#ERRI DataFld=RATE.RATE1 Value="3" Type=Radio id=Radio1 name=Radio1></Td><td>3</td></Tr>  
    <Tr><Td><Input DataSrc=#ERRI DataFld=RATE.RATE1 Value="4" Type=Radio id=Radio1 name=Radio1></Td><td>4</td></Tr>  
    </Table> 

  • Cfdiv refreshes binding to radio buttons

    Hi,
    Fairly simple issue that I can't find much information about
    through google (just one report of it involving a workaround for a
    cfgrid rather than a cfdiv).
    I have a cfdiv that is bound to a cfselect and two radio
    buttons, ala:
    <cfdiv
    bind="url:schedule-snippet.cfm?selectAll={selectAll}&orderBy={orderBy}&startDate={startDa te}"
    id="schedule">
    selectAll and orderBy are both radio buttons, each of which
    has two states. startDate is a cfselect.
    The problem is that the cfdiv does not auto-refresh based on
    whichever radio button I pass in second -- e.g. in the example
    above, it will refresh based on the selectAll radio button but not
    the orderBy radio button. If I bind it this way:
    <cfdiv
    bind="url:schedule-snippet.cfm?orderBy={orderBy}&selectAll={selectAll}&startDate={startDa te}"
    id="schedule">
    Then it will refresh from the orderBy but not the selectAll.
    Even more interesting is that, if I put the cfselect
    (startDate) AFTER the second radio button in the bind list (as
    above) then it won't refresh from that, either. It just sort of
    'stops' auto-refreshing once you put in a radio button value. with
    anything after that value in the list.
    Any ideas?
    Thanks,
    Sam

    this is strange and must be a bug... i have reproduced your
    situation
    exactly.
    i have ran all sorts of tests, and always the second radio
    set does not
    trigger cfdiv refresh.
    setting the first bind param in your cfdiv to your cfselect
    will make
    the div refresh on change in the cfselect and the first
    binded radio
    group, but not the second one.
    same with checkboxes instead of radio buttons - the second
    binded set of
    checkboxes never triggers the cfdiv refresh.
    having cfdiv bind to 3 selects instead of 1 select and 2
    radio/checkbox
    groups works fine - cfdiv refreshes on change in any of the
    selects.
    furthermore, adding another cfselect and binding cfdiv to
    that as well
    (so 4 controls cfdiv is binded to now) starts throwing js
    errors in
    ajax.js file... but also makes everything work after you
    ignore the
    error (cfdiv refreshes on change in any of the 4 controls).
    definitely a bug - you may want to submit it to adobe.
    one work-around may be to cal a js function from the second
    radio
    group's onclick event which will get surrent values of the 3
    controls
    and use ColdFusion.navigate to refresh the cfdiv...
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

  • Radio Buttons, Global Binding, and Change Event

    I have a pair of radio button groups with the same name that I have set to Global binding.  The radio buttons in these radio button groups have script in the change event.  The problem is, when I click on a button in one group, it doesn't fire the change event in the other one, even though the corresponding button changes.  I can work around this, but I'm curious why this doesn't work.

    ocen12 is correct - the change event will only fire when a user clicks on the radiobutton. It will not fire when a script changes the value. I tried it here and found that the radio buttons on both groups act like they are under the same exclusion group. Do you see the same thing? If I select a value in the second exclusion group any value I had in the 1st one is gone.
    Paul

  • Global binding for radio buttons needs tweaking

    When selecting global binding for a text or numeric field, its corresponding field with the same name also changes to global binding.
    However when doing this for radio button exclusion groups, the other radio button groups don't automatically change to global. You have to do it manually.

    Found the problem in another topic:
    scott sheck - 1:30am Jun 29, 07 PST (#6 of 7)
    A pasted radio button is automatically added to an existing exclusion group if the last added item was a radio button. This is in the help.
    I wish there was a default to turn this off because I don't want to add a temporary item just to get a new exclusion group.

  • Check boxes, Radio Buttons, and XML Field Order

    I am working with Adobe Designer Version 7.0. Hopefully this forum can still address my issues.
    I am creating a registration form that will often be submitted via email to us for processing. To help make the data both easy to transfer for us into our excel file  and to minimize the errors made by the people using the form, I need the form to be able to do a couple of things that I am having a hard time figuring out. My questions are the following:
    I have a list of 7 check boxes that each insert a dollar value into a seperate numeric field on the form. Each check box has a unique dollar value associated with it. Is there any way to design the form so the user can only choose one of the check boxes? I tried using radio buttons in a group, but if a user mistakenly chose the wrong radio button and then selected another button from that group, it would add to the total in the Application Fee field and not subtract out the previous amount. Below is the code i used for one of the check boxes.
    I have two numeric fields that the user must choose one or the other. Can I design those two fields (numHomes and numBuildings) so that if the you enter a value for one field, you cannot enter a value for the other field? Both fields are then calcuated in a seperate numeric field. Below is the code i used for the numeric field.
    I want to be able to take the data emailed to us as an XML file  when a user submits the results via email and directly paste it into our Excel file. To keep the cut and paste process simple, I want to make sure the order of the XML fields matches the order of the database fields so it can be done in one shot. Do you know how to organize the XML fields? They do not seem to correspond to the ordering found under the Hierarchy tab. Any thoughts on this?
    Thanks
    if (this.rawValue == 1) then
           numAppFee.rawValue = numAppFee.rawValue + 350;
    else
           numAppFee.rawValue = numAppFee.rawValue - 350;
    endif
    numHomes * 50 + numBuildings * 100 + numDups * 10

    Create an XML Schema (XSD) and define that as the default form schema. The form data will conforms to the order of fields defined in the XML schema.
    Hope that helps.
    Nith

  • Creating radio buttons in XML Forms Builder

    Hi everyone,
    I can't seem to find any instructions on how to create Radio Buttons in XML Forms builder, anyone has a link or instruction on how to?
    Thanks,
    Samer

    Hi Samer,
    So taking the example for the slides, you need first to create a new child under DataModel for the DataSchema. You can name it "Gender".
    Click on the Radio Button in the Toolbar and drag "Gender" from the left hand site into the Edit Form.
    It should have already a first radio button and in the box on the bottum right you should see the reference in the Schema Reference field (/DataShema/DataModel/Gender).
    You can now drag a second button from the toolbar and place it behind the first one. Make sure you add the same value in the Schema Reference field.
    On the Show form or RenderListItem you need a Control Selector as mentioned on slide 18. You can just use right mouse click -> Add. Go on the new item on the right hand side, and click on "Add Multiple Labels". You can choose now how many radio buttons you have, here 2.
    In our example enter in one Label "Condition" = "true" and "Label" = "Male" and in the other "Condition" = "false" and "Label" = "Female".
    Finally, make sure that the Control Selector has the Schema Reference also as defined above (/DataShema/DataModel/Gender).
    Hope this helps,
    Robert

  • How do you bind a radio button to a row in a table

    Im developing a web page that does a search given certain criteria. It displays the results in a table and dynamically allocates a radio button for each row that is created.
    I then want to be able to select the radio() button and display the row that was selected by the radio button on another page.
    Im doing a project in college developing a online airline ticket booking system. The user searches for flights and is displayed back with the Outgoing flights and the return flights. Each flight that is displayed is given a radio button. The problem is that I want to let the user select the a radio button that corresponds with their choice of flight and display this flight on the next page.
    Can anyone help me please with some code or ideas on how to go about doing it
    Thanks very much Nicky

    I suppose you do something like this:
    <sql:query var="var" scope="request">
    SELECT * FROM table
    WHERE something = ?
    <sql:param value="${param.something}" />
    Right??
    When you start the page, add:
    <%@ page language="java" %>
    Then under that
    <% int i = 0; %>
    Then:
    <html>
    <body>
    <form action="your_action" method="post">
    <table>
    <c:forEach items="${var.rows}" var="v">
    <% i++; %>
    <tr>
    <td>
    <input type="radio" name="yourname<%= i %>" value="yourvalue">
    </td>
    </tr>
    </c:forEach>
    <tr>
    <td>
    <input type="Hidden" name="i" value="<%= i %>">
    <input type="Submit value="next page">
    etc. etc.
    Follow me so far?

  • Collection binding to radio button: No command button action

    Hi,
    I bound a List collection to radio buttons as below.
    <h:selectOneRadio disabledClass="selectOneRadio_Disabled"
                   styleClass="selectOneRadio" id="radio1" layout="pageDirection" value="#{param.selectedChoideId}">
    <f:selectItems value="#{PollBean.choices}" />
    </h:selectOneRadio>
    I also added a command button to send the value of selected radio item. The item labels and values are displayed properly on run time.
    But when the button is clicked, the JSF lifecycle is started but the execution thread cannot enter phase 4 called "Update Model Value" after phase 3 "Process Validations" and directly jump to phase 6 called "Render Response". By this way, navigation rule is not applied and the execution gets back to the starting page.
    Is there anyone have encountered this problem ever before ? What can cause this problem ?
    Regards.
    UmutRR

    It might be a typical problem of SelectOne/Many.
    Check the types of param.selectedChoideld and PollBean.choices.
    My post will help you:
    http://forum.java.sun.com/thread.jspa?threadID=604798

  • Connecting selection of radio button to a text or numeric field

    Hi. I am using LiveCycle Designer 8.0 and I am trying to define object properties that will allow the selection of a radio button to populate in a numeric data field at the bottom of the page. I was able to write the script to have that happen with drop-down lists, but I can't figure out how to write the script for the radio button. I also don't know if the script is supposed to apply to the radio button itself or the numeric field where I want the result to show-up. Can you please help me with some sort of an example script? Thanks.

    Hi Jen,
    I would recommend that you amend your workspace in Designer. You can show/hide palettes from the Window menu.
    Here are some pointers (which are optional):
    This is the hierarchy palette and is very handy when working with forms. You can select objects quickly and drag objects around.
    This is the Object palette, which makes it easy to drag objects onto the page.
    The main space with tabs for Design View, Master Pages, XML Source (you should not need this) and Preview.
    You can select objects in EITHER the page or the hierarchy view and then change properties in other palettes.
    The Script Editor is very important when you start to add functionality to your form. It is visible on your screen shot, but it is limited to one line in height. So I would recommend that you drag this down so that you can see a few lines of script. The Show dropdown in the Editor allows you to look at the script in various events. In the example I posted, there is script in the click event.
    Object palette (and Font & Paragraph palettes). These will allow you to make changes to various properties, depending on the object that is selected.
    You will see from the screenshot that you can position and stack the palettes to suite your screen and workflow.
    Now, in relation to your screenshot:
    You have selected a single radio button in your group. You need to select the whole exclusion group, this is easy in the hierarchy palette.
    In the Object > Binding palette you have ticked the Specify Item Values (good), but you need to edit the values to match the Display Items. For example for item "$85", the specified value should be "85".
    For starters, I would recommend that you open a few of the palettes and then have a look at my example and the screenshots. Hopefully that will clear it up for you.
    Niall

  • Radio Buttons Defaulting to YES when form is saved

    Hello, I'm researching a problem a user has informed me of, and I haven't seen this topic listed anywhere, nor have I been able to figure out why the problem is happening.
    My form has 5 radio button exclusion groups, each with a YES or NO selection.
    When the form is saved with a selection of NO for each group then re-opened, the selected value has changed to YES for all but the first group.
    Anyone have an idea why this is happening?

    Is there any script on the form that could be changing the values after loading?
    As a test, add a button on the form and use this code on the click event:
    xfa.host.exportData();
    When the button is clicked, it will allow the user to choose a filename to save the data into (it will have an XDP extension). Once it is saved change the extension to XML and open it in your browser. Check and see that those button groups are being set. If they are not it could be that they are not bound correctly. Check to see if the Binding is set to none (if so you are excluding these from your data).
    Hope that helps.

  • What is the diffrence  between "Key to Select" and "Selected Key" while creating Radio  Buttons?

    While creating radio buttons there is a confusion regarding two properties "Key to Select" and "Selected Key".Can anybody explain it with example?
    Thanks,
    Vimal

    Hi Vimal,
    Please find my explanation as below
    Key to Select: This is the unique key for each radio button to identify which one is selected
    Selected Key: This holds the "KEY" of selected radio button
    Example:
       Let us say we have 2 radio buttons : Male & Female
         Create a context attribute SELECTED_KEY of type STRING.
         Create an action ON_SELECT for radio button select event
         Now,
         the properties for "MALE" radio button as below
              KEY_TO_SELECT = 'M'
              SELECTED_KEY = "bind to the context attribute SELECTED_KEY
              OnSelect = 'ON_SELECT'.
         The properties for 'Female" radio button as below
              KEY_TO_SELECT = 'F'
              SELECTED_KEY = "bind to the context attribute SELECTED_KEY
              OnSelect = 'ON_SELECT'.
    If we select radio button 'Male', we get the key as 'M' and for 'Female' radio button 'F'.
    check inside the event handler method ONACTIONON_SELECT, you get the 'KEY' of selected radio button.
    So, the context attribute 'SELECTED_KEY'  gets filled with the key of selected radio button
    Hope this helps you in distinguishing the 'KEY TO SELECT' & 'SELECTED KEY' .
    Regards,
    Rama

  • Radio button's click event to script both ".presence" and ".mandatory" -- Need help !

    Hi all,
    I've adopted the script stated in HightlightOneRequiredField.pdf so that the print button in my form can detect and prevent null field before pop up the print dialog. It works fine.
    In my form, I've created a mandatory 2-radio buttons group with click event script written, using ".presence", in each button. When user clicks:
    Button A: make subform A visible and subform B invisible;
    Button B: make subform A invisible and subform B visible.
    Apart from the visibility of the subforms, what I want more is to add a .mandatory script (together with the click event) in the buttons to turn some fields' mandatory in the subforms on and off so that when user clicks:
    Button A: will also turn some fields' value type in subform A to be "User
    Entered-Required", whereas some of that in subform B to be "-
    optional";
    Button B: will turn the subform B's fields to "-Required" and subform A's
    fields back to "-optional"
    However no luck with me. When I press the print button after any of the radio buttons checked, the print dialog still show up even the subforms' fields are null as if those fields' value type always remain "-optional"
    I wonder if this problem is caused by Chinese binding name ? The script written in the radio button B is:
    FormA.presence = "invisible";
    FormB.presence = "visible";
    if (B1.mandatory = "disabled")
    B1.mandatory = "error";
    if (B2.mandatory = "disabled")
    B2.mandatory = "error";
    if (B3.mandatory = "disabled")
    B3.mandatory = "error";
    if (A1.mandatory = "error")
    A1.mandatory = "disabled";
    if (A2.mandatory = "error")
    A2.mandatory = "disabled";
    if (A3.mandatory = "error")
    A3.mandatory = "disabled";
    B1, B2 and B3 represent the Chinese fields' binding name in FormB
    A1, A2 and A3 represent the Chinese fields' binding name in FormA
    (The script in radio button A is reversed in this way.)
    Have I done something wrong in the above (click event) javascript?
    Please help.
    Thanks in advance.
    Alex

    Hi all,
    I've adopted the script stated in HightlightOneRequiredField.pdf so that the print button in my form can detect and prevent null field before pop up the print dialog. It works fine.
    In my form, I've created a mandatory 2-radio buttons group with click event script written, using ".presence", in each button. When user clicks:
    Button A: make subform A visible and subform B invisible;
    Button B: make subform A invisible and subform B visible.
    Apart from the visibility of the subforms, what I want more is to add a .mandatory script (together with the click event) in the buttons to turn some fields' mandatory in the subforms on and off so that when user clicks:
    Button A: will also turn some fields' value type in subform A to be "User
    Entered-Required", whereas some of that in subform B to be "-
    optional";
    Button B: will turn the subform B's fields to "-Required" and subform A's
    fields back to "-optional"
    However no luck with me. When I press the print button after any of the radio buttons checked, the print dialog still show up even the subforms' fields are null as if those fields' value type always remain "-optional"
    I wonder if this problem is caused by Chinese binding name ? The script written in the radio button B is:
    FormA.presence = "invisible";
    FormB.presence = "visible";
    if (B1.mandatory = "disabled")
    B1.mandatory = "error";
    if (B2.mandatory = "disabled")
    B2.mandatory = "error";
    if (B3.mandatory = "disabled")
    B3.mandatory = "error";
    if (A1.mandatory = "error")
    A1.mandatory = "disabled";
    if (A2.mandatory = "error")
    A2.mandatory = "disabled";
    if (A3.mandatory = "error")
    A3.mandatory = "disabled";
    B1, B2 and B3 represent the Chinese fields' binding name in FormB
    A1, A2 and A3 represent the Chinese fields' binding name in FormA
    (The script in radio button A is reversed in this way.)
    Have I done something wrong in the above (click event) javascript?
    Please help.
    Thanks in advance.
    Alex

Maybe you are looking for

  • Error in Forms but not in sql

    hello, Machine A (win 98, dev) : Forms app(client/server) which calls a stored procedure - works fine Machine B (win NT) : the same Forms app sends an error raised by the stored procedure (data conversion error); in the same time, on this machine, th

  • Purchase order for Capital Asset.

    Hello, How can I create the purchase orders for Capital Asstes? Narendra.

  • SAP exit 0DAT is not filled

    SAP Exit variable 0DAT for Calendar Day does not fill upon execution in BEx. Anyone experienced this problem before or suggestions to correct it? Thanks for any inputs, Petter

  • Bluetooth Module

    I purchased a Magic Mouse to replace my S510 Logitech mouse which I loved, but it broke down. Love the magic mouse, but my Mac Pro 1,1 doesn't have the installed Bluetooth module. I've been getting by with a micro USB generic radio plugged into one o

  • CAT 4510 High CPU usage

    My CAT 4510 switch is showing 99.9% CPU usage almost through out the day. After some analysis i saw that the "Cat4k Mgmt LoPri" process is having 86% CPU utilization. This process is a package that is including multiple process. 2.       Within this