Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Radio Button and DataBinding

Avatar

Former Community Member
Hi,



I have a group of two radio buttons in a form. I bind it with an xml schema but when I try to use the value of the radio button selected (1 for the first and 2 for the second) my variable logger print me null.



How can I bind radio buttons to know the selected one ?



Thank You :)
9 Replies

Avatar

Former Community Member
Try writing the data out of the form to ensure it is getting to the server. Then we can determine if there is something wrong with your XPath statement.

Avatar

Former Community Member
I don't understand what you mean by writing the data out of the form neither how to do that but if it could help, in my form, I have several fields (drop down list, textfield and check box ) binding with my xml schema and I have no problems with them.



If you explain me what you mean I could try your solution. Thanks again :D

Avatar

Former Community Member
You can add a button to the form and add this code on th eclick event:



xfa.host.exportData()



This will allow you to save your data file locally so we can see that the RadioButtonList values are getting set in the xml data file.

Avatar

Former Community Member
OK, the RadioButtonList value is empty in the xml data file.

Avatar

Former Community Member
Then that explains why you cannot write it out on the server. The binding between the radiobuttonlist and your element in your schema is incorrect. Are you binding to individual radiobuttons or to the RadioButtonList?



Once you ensure that the data is appearing in the xml then you will be able to use it on the server side.

Avatar

Former Community Member
I try to bind it with a radiobutton but it binds it always with my RadioButton group. I will try to bind it correctly with my schema because of your trick you gave me.



What kind of type must be the element in my schema to bind the radio button correctly ? Int, Boolean , String ?

Avatar

Former Community Member
I'm mistake myself. The RadioButton value appears in the xml data and is correct ( value 1 or 2)

Avatar

Former Community Member
OK, finally I have no values for all my fields in one form in the process.



I have a process with an Initform. The form is binding with an xml schema.

The user fill it and I map the fields with a setValue in a string variable and in the second form with the same schema. As so far no problems, it works.



Next the second form is approved or denied and I map the fields with a setValue and there is a problem. I tried to map into string variables, xml variables, boolean variables and I've got nothing. I don't understand. This is the same schema and it works nice the first time.



Thank you.

Avatar

Former Community Member
Hi,



I have a mapping problem. In my process I have two forms with the same xml schema binding to this forms.



The first form is prefill with his informations (name, division, email etc ...), his superior informations and he can choose and fill a new superior.



Once the form is fill and send, the new superior received the form with the completed informations.



I use a setValue to extract the name of the superior and to associate it with an Assign Task and map the data of the first form into the second form and it works.



After the second form is approved, I need to exctract some other informations but whatever I can do, all the values are null. However when I extract data from the form with the function xfa.host.exportData(); the data xml is fill with the correct information.



In my first setValues I map the field login of my form with this xpath :



location expression



/process_data/@nplusun /process_data/FormInit/object/data/xdp/datasets/data/FormulaireA/Nouveau/login



and the data



/process_data/FormEtape2/object/data/xdp/datasets/data /process_data/FormInit/object/data/xdp/datasets/data



It works.



In my second setValues I do :



location



/process_data/@name /process_data/FormEtape2/object/data/xdp/datasets/data/FormulaireA/Ancien/NomPrenom



I try with serializable, with an xml variable assiocated to the same schema than my form.



I never had a problem of mapping, I don't understand what appends :(



Thank You for helping me