You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by chaitanya b <ha...@gmail.com> on 2012/05/17 07:56:53 UTC
How to save the selected radio choice option in wicket
Hi,
I am new to Apache wicket. Can you please help me how to get the selected
radio choice option in wicket.I have to save the some recruitment form with
some fileds which we have to give dynamically .I have a static dropdown
with list of form fileds like text filed, text area, radio button, check
box. when i select the textbox and text area , the values are saved
successfully with the correct values which i have given. Now requirement
is when i select the radio button in the static drop down, by clicking the
submit i have created the radio buttons with list of input values for the
radio button options which i have given dynamically. But i didnt get the
value which i have selected when saving that form. Am getting the null
value when saving the form I did not get what the exact problem
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-save-the-selected-radio-choice-option-in-wicket-tp4642586.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to save the selected radio choice option in wicket
Posted by "Richard W. Adams" <RW...@UP.COM>.
Conceptually, it's no different than any other form control. You associate
the control with a named property in your model, & when the form is
submitted that property will be populated with the chosen value. If the
user hasn't chosen ANY value, yes, you can get null.
From: chaitanya b <ha...@gmail.com>
To: users@wicket.apache.org
Date: 05/17/2012 12:57 AM
Subject: How to save the selected radio choice option in wicket
Hi,
I am new to Apache wicket. Can you please help me how to get the selected
radio choice option in wicket.I have to save the some recruitment form
with
some fileds which we have to give dynamically .I have a static dropdown
with list of form fileds like text filed, text area, radio button, check
box. when i select the textbox and text area , the values are saved
successfully with the correct values which i have given. Now requirement
is when i select the radio button in the static drop down, by clicking the
submit i have created the radio buttons with list of input values for
the
radio button options which i have given dynamically. But i didnt get the
value which i have selected when saving that form. Am getting the null
value when saving the form I did not get what the exact problem
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/How-to-save-the-selected-radio-choice-option-in-wicket-tp4642586.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
**
This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient. Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law. If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.
**
Re: How to save the selected radio choice option in wicket
Posted by Andrea Del Bene <ad...@ciseonweb.it>.
Your solution should work the way it is. It's likely that you have a
problem with form's submission. Are you sure that when you press 'save'
button the form is submitted? And are you sure that radioButton has been
added to the form that should be submitted by 'save' button?
> how can i set the property value then?
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-save-the-selected-radio-choice-option-in-wicket-tp4642586p4642832.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to save the selected radio choice option in wicket
Posted by chaitanya b <ha...@gmail.com>.
The following is just sample code
private static List<String> GENDER =null;
private String[] separatedvalues =null;
private String selected="Male";
public ComponentRadioButtonField(RecruitmentFormFieldsDetails details,
PropertyModel<String> propertyModel, String mode) {
add( new Label( "name" , details.getFieldName()) );
if(details.getDefaultValue().contains(COMMA)){
separatedvalues = details.getDefaultValue().split(",");
}
GENDER = Arrays.asList(separatedvalues);
add( new RadioChoice<String>("radioButton", new
PropertyModel<String>(this, "selected" ),GENDER ).setSuffix(""));
In the RecruitmentFormFieldsDetails , we are maintaining all the
fields(like radio buttons, check boxes, text filed...). Whenever we clicked
the corresponding field, we are providing an option
to enter the input values dynamically with comma separated values.
After saving the form, The registration form will be ready with this fields
what we have added in the recruitment form.
At the time of registration, i entered the answers in the
registration form and click the save button , the value which i was
selected for the radio button was not saved in db.
corresponding html page is
<wicket:panel>
<label wicket:id="name" >label</label>
<span wicket:id="radioButton"/>
</wicket:panel>
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-save-the-selected-radio-choice-option-in-wicket-tp4642586p4642917.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to save the selected radio choice option in wicket
Posted by "Richard W. Adams" <RW...@UP.COM>.
Just like anything else: You put the desired value in your model & Wicket
handles "selecting" the correct button.
From: chaitanya b <ha...@gmail.com>
To: users@wicket.apache.org
Date: 05/17/2012 06:06 AM
Subject: Re: How to save the selected radio choice option in wicket
how can i set the property value then?
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/How-to-save-the-selected-radio-choice-option-in-wicket-tp4642586p4642832.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
**
This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient. Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law. If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.
**
Re: How to save the selected radio choice option in wicket
Posted by chaitanya b <ha...@gmail.com>.
how can i set the property value then?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-save-the-selected-radio-choice-option-in-wicket-tp4642586p4642832.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to save the selected radio choice option in wicket
Posted by Andrea Del Bene <ad...@ciseonweb.it>.
Property 'selected' is not setted according to the selected GENDER? Does
property 'selected' remains null when you press 'save' button ?
> add( new RadioChoice<String>("radioButton", new PropertyModel<String>(this,
> "selected" ),GENDER ).setSuffix(""));
>
>
> Here I taken Gender as a list of values dynamically . The fields are saved
> successfully when the form was saved. In the registration page i retrieve
> the fields what i have added. In that i select one option and click the
> save button but i am getting the null value. The selected value is not saved
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-save-the-selected-radio-choice-option-in-wicket-tp4642586p4642713.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to save the selected radio choice option in wicket
Posted by chaitanya b <ha...@gmail.com>.
add( new RadioChoice<String>("radioButton", new PropertyModel<String>(this,
"selected" ),GENDER ).setSuffix(""));
Here I taken Gender as a list of values dynamically . The fields are saved
successfully when the form was saved. In the registration page i retrieve
the fields what i have added. In that i select one option and click the
save button but i am getting the null value. The selected value is not saved
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-save-the-selected-radio-choice-option-in-wicket-tp4642586p4642713.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: How to save the selected radio choice option in wicket
Posted by Andrea Del Bene <ad...@ciseonweb.it>.
Hi,
can you show the code you use to build radio buttons?
> Hi,
> I am new to Apache wicket. Can you please help me how to get the selected
> radio choice option in wicket.I have to save the some recruitment form with
> some fileds which we have to give dynamically .I have a static dropdown
> with list of form fileds like text filed, text area, radio button, check
> box. when i select the textbox and text area , the values are saved
> successfully with the correct values which i have given. Now requirement
> is when i select the radio button in the static drop down, by clicking the
> submit i have created the radio buttons with list of input values for the
> radio button options which i have given dynamically. But i didnt get the
> value which i have selected when saving that form. Am getting the null
> value when saving the form I did not get what the exact problem
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-save-the-selected-radio-choice-option-in-wicket-tp4642586.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org