Re: Radio button submits encoded value
Hi, your Radio can override #getValue() and return a custom value, see its javadoc. Have fun Sven Am 15.05.19 um 21:29 schrieb Entropy: We have a general audit requirement to capture literally every request and log it and it's parameters. We are stripping these parameters from the HttpServletRequest object in a common method. Works great...except when it doesn't. We have a page where the radio buttons are producing a particularly nonhelpful log record because even though the object declares a model value of 'Y' or 'N', and the HTML has values of 'yes' and 'no', Wicket is putting out 'radio47' and similarly unhelpful things. Our L2 customer service person is great at figuring out what users did wrong from our audit logs. But she can't make heads or tails of 'radio47'. Here's the object declaration: RadioGroup q1 = new RadioGroup("q1", new PropertyModel(adptModel, "seizureArrestedFlag")); add(q1.setRequired(true).setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true)); q1.add(new Radio("q1_yes", Model.of("Y"))); q1.add(new Radio("q1_no", Model.of("N"))); Here's the HTML (I hope this goes through okay) So given that the HTML has values of 'yes' and 'no', and the java has a Model of 'Y' and 'N', I need the request to actually have one of those, not 'Radio47'. Mind you, when the java submit runs, it's getting the right value. This 'Radio47' is clearly just something Wicket is doing internally. I'm just wondering how to get my audit log right. -- Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Radio button submits encoded value
We have a general audit requirement to capture literally every request and log it and it's parameters. We are stripping these parameters from the HttpServletRequest object in a common method. Works great...except when it doesn't. We have a page where the radio buttons are producing a particularly nonhelpful log record because even though the object declares a model value of 'Y' or 'N', and the HTML has values of 'yes' and 'no', Wicket is putting out 'radio47' and similarly unhelpful things. Our L2 customer service person is great at figuring out what users did wrong from our audit logs. But she can't make heads or tails of 'radio47'. Here's the object declaration: RadioGroup q1 = new RadioGroup("q1", new PropertyModel(adptModel, "seizureArrestedFlag")); add(q1.setRequired(true).setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true)); q1.add(new Radio("q1_yes", Model.of("Y"))); q1.add(new Radio("q1_no", Model.of("N"))); Here's the HTML (I hope this goes through okay) So given that the HTML has values of 'yes' and 'no', and the java has a Model of 'Y' and 'N', I need the request to actually have one of those, not 'Radio47'. Mind you, when the java submit runs, it's getting the right value. This 'Radio47' is clearly just something Wicket is doing internally. I'm just wondering how to get my audit log right. -- Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Radio button select not selecting
Please provide a quickstart[1], so we can debug the problem. Regards Sven [1] http://wicket.apache.org/start/quickstart.html Am 03.03.2015 um 11:49 schrieb avchavan: Tried that as well but did not change in behavior. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Radio-button-select-not-selecting-tp4669792p4669803.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Radio button select not selecting
Tried that as well but did not change in behavior. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Radio-button-select-not-selecting-tp4669792p4669803.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Radio button select not selecting
You have to add that behavior to the Radio*Group*. Sven Am 03.03.2015 um 07:52 schrieb avchavan: Yes, accordion is adding listView to target. Tried using AjaxFormChoiceComponentUpdatingBehavior but it is throwing following exception at runtime: org.apache.wicket.WicketRuntimeException: Behavior {className} can only be added to an instance of a FormComponent code: selectable.add(new AjaxFormChoiceComponentUpdatingBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { System.out.println("inside onclick"); accordion(target, dienstsContainer, descriptionContainer, dienstContainer); } }); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Radio-button-select-not-selecting-tp4669792p4669800.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Radio button select not selecting
Yes, accordion is adding listView to target. Tried using AjaxFormChoiceComponentUpdatingBehavior but it is throwing following exception at runtime: org.apache.wicket.WicketRuntimeException: Behavior {className} can only be added to an instance of a FormComponent code: selectable.add(new AjaxFormChoiceComponentUpdatingBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { System.out.println("inside onclick"); accordion(target, dienstsContainer, descriptionContainer, dienstContainer); } }); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Radio-button-select-not-selecting-tp4669792p4669800.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Radio button select not selecting
Hi, is #accordion() adding the listView or any of its parents to the AjaxRequestTarget? Then the radios are replaced in the browser and lose their selection. You should use an AjaxFormChoiceComponentUpdatingBehavior on the RadioGroup instead. Regards Sven Am 02.03.2015 um 13:19 schrieb avchavan: changed java code to: final Radio selectable = new Radio("selectable", new Model(Boolean.FALSE)); selectable.setOutputMarkupPlaceholderTag(true); /*selectable.add(new AttributeAppender("onclick", new Model("if (event.stopPropagation) { "+ "event.stopPropagation();"+ "} else { "+ "event.cancelBubble = true;" +"}"), ";"));*/ selectable.add(new AjaxEventBehavior("onclick") { @Override protected void onEvent(AjaxRequestTarget target) { System.out.println("inside onclick"); accordion(target, dienstsContainer, descriptionContainer, dienstContainer); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.setAllowDefault(true); attributes.setEventPropagation(EventPropagation.STOP); } }); Still not working. I can see the dot inside the radio when i click but then it goes away immediately. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Radio-button-select-not-selecting-tp4669792p4669794.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Radio button select not selecting
changed java code to: final Radio selectable = new Radio("selectable", new Model(Boolean.FALSE)); selectable.setOutputMarkupPlaceholderTag(true); /*selectable.add(new AttributeAppender("onclick", new Model("if (event.stopPropagation) { "+ "event.stopPropagation();"+ "} else { "+ "event.cancelBubble = true;" +"}"), ";"));*/ selectable.add(new AjaxEventBehavior("onclick") { @Override protected void onEvent(AjaxRequestTarget target) { System.out.println("inside onclick"); accordion(target, dienstsContainer, descriptionContainer, dienstContainer); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.setAllowDefault(true); attributes.setEventPropagation(EventPropagation.STOP); } }); Still not working. I can see the dot inside the radio when i click but then it goes away immediately. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Radio-button-select-not-selecting-tp4669792p4669794.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Radio button select not selecting
Hi, since you're allowing the default, the radioButton should get selected when you click on it. I'm not sure about your "onclick" attribute though - why aren't you using AjaxRequestAttributes#setEventPropagation(STOP) ? Regards Sven Am 02.03.2015 um 12:51 schrieb avchavan: Hi here is my code: JAVA: final RadioGroup radioGroup = new RadioGroup("radioGroup"); final Radio selectable = new Radio("selectable", new Model(Boolean.FALSE)); selectable.setOutputMarkupPlaceholderTag(true); selectable.add(new AttributeAppender("onclick", new Model("if (event.stopPropagation) { "+ "event.stopPropagation();"+ "} else { "+ "event.cancelBubble = true;" +"}"), ";")); selectable.add(new AjaxEventBehavior("onclick") { @Override protected void onEvent(AjaxRequestTarget target) { System.out.println("inside onclick"); accordion(target, mainContainer, descriptionContainer, baseContainer); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.setAllowDefault(true); } }); radioGroup.add(selectable); radioGroup.setOutputMarkupPlaceholderTag(true); baseContainer.add(radioGroup); The above code is a part of a list view code. HTML: My problem is the onClick event of the radio button click gets fired but the radio button is never selected. Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Radio-button-select-not-selecting-tp4669792.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Radio button select not selecting
Hi here is my code: JAVA: final RadioGroup radioGroup = new RadioGroup("radioGroup"); final Radio selectable = new Radio("selectable", new Model(Boolean.FALSE)); selectable.setOutputMarkupPlaceholderTag(true); selectable.add(new AttributeAppender("onclick", new Model("if (event.stopPropagation) { "+ "event.stopPropagation();"+ "} else { "+ "event.cancelBubble = true;" +"}"), ";")); selectable.add(new AjaxEventBehavior("onclick") { @Override protected void onEvent(AjaxRequestTarget target) { System.out.println("inside onclick"); accordion(target, mainContainer, descriptionContainer, baseContainer); } @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.setAllowDefault(true); } }); radioGroup.add(selectable); radioGroup.setOutputMarkupPlaceholderTag(true); baseContainer.add(radioGroup); The above code is a part of a list view code. HTML: My problem is the onClick event of the radio button click gets fired but the radio button is never selected. Thanks -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Radio-button-select-not-selecting-tp4669792.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Radio Button
sorry, I am idiot! I forgot to assign an model to it. On Fri, Mar 7, 2014 at 11:53 AM, Shengche Hsiao wrote: > Suppose I have a map (data source from db and have unknown size) as follows > > final Map data = new HashMap(); > data.put("TEST1", "DESCRIPTION1"); > data.put("TEST2", "DESCRIPTION2"); > data.put("TEST3", "DESCRIPTION3"); > data.put("TEST4", "DESCRIPTION4"); > final List key = new ArrayList(); > key.addAll(data.keySet()); > > in order to use RadioGroup i transfer the map keyset to list! > > as you can see, i want users to check radio and get it's key to find map > value! > > But i cannot assign the key into radio's value, do you have any > suggestions? > > > -- > > ---> > We do this not because it is easy. We do this because it is hard. > ---> > ShengChe Hsiao > ---> > front...@gmail.com > front...@tc.edu.tw > ---> > VoIP : 070-910-2450 > ---> > -- ---> We do this not because it is easy. We do this because it is hard. ---> ShengChe Hsiao ---> front...@gmail.com front...@tc.edu.tw ---> VoIP : 070-910-2450 --->
Radio Button
Suppose I have a map (data source from db and have unknown size) as follows final Map data = new HashMap(); data.put("TEST1", "DESCRIPTION1"); data.put("TEST2", "DESCRIPTION2"); data.put("TEST3", "DESCRIPTION3"); data.put("TEST4", "DESCRIPTION4"); final List key = new ArrayList(); key.addAll(data.keySet()); in order to use RadioGroup i transfer the map keyset to list! as you can see, i want users to check radio and get it's key to find map value! But i cannot assign the key into radio's value, do you have any suggestions? -- ---> We do this not because it is easy. We do this because it is hard. ---> ShengChe Hsiao ---> front...@gmail.com front...@tc.edu.tw ---> VoIP : 070-910-2450 --->
Re: radio button ajax behaviour
What is your problem? Usually you would use FormChoiceComponentUpdatingBehavior on the RadioGroup. Sven "david.li" schrieb: >Hi,I am unable to apply ajax behavior to radio button. >there are two radio button in radiogroup.but when click month radio button,i >can't check this radio. > >java code: >RadioGroup group=new RadioGroup("group"); > >group.add(new Radio("week")); > >Radio monthRadio=new Radio("month"); >monthRadio.add(new AjaxEventBehavior("onclick") { > @Override > protected void onEvent(AjaxRequestTarget target) { > info("1"); > target.add(feedback); > } >}); >group.add(monthRadio); > >Regards, >david li > > > >- >david >-- >View this message in context: >http://apache-wicket.1842946.n4.nabble.com/radio-button-ajax-behaviour-tp4656909.html >Sent from the Users forum mailing list archive at Nabble.com. > >- >To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >For additional commands, e-mail: users-h...@wicket.apache.org >
radio button ajax behaviour
Hi,I am unable to apply ajax behavior to radio button. there are two radio button in radiogroup.but when click month radio button,i can't check this radio. java code: RadioGroup group=new RadioGroup("group"); group.add(new Radio("week")); Radio monthRadio=new Radio("month"); monthRadio.add(new AjaxEventBehavior("onclick") { @Override protected void onEvent(AjaxRequestTarget target) { info("1"); target.add(feedback); } }); group.add(monthRadio); Regards, david li - david -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/radio-button-ajax-behaviour-tp4656909.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Radio button selection
Tito, Thank you for the clarification.It was a great help. Regards. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Radio-button-selection-tp4085827p4096406.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Radio button selection
Hey Alex Your sample app was quite helpful...Thanx alot -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Radio-button-selection-tp4085827p4096389.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Radio button selection
Check quickstart app http://apache-wicket.1842946.n4.nabble.com/file/n4096248/myproject.zip myproject.zip Hope it helps :) - -- http://www.linkedin.com/in/amorozov -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Radio-button-selection-tp4085827p4096248.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Radio button selection
I think I can give you another option based on Alexander's code. I added comments to explain how does it works. I didn't test it but If you have any problem just tell me: // model that indicates if I have to show the textfield final IModel yesNoState = new Model(); // this is because when textfield is hidden you can't reference it by markupid because html component doesn't exists. final WebMarkupContainer fieldContainer = new WebMarkupContainer("fieldContainer"); // this indicates wicket to create an id for tag. Necesary to update by ajax. fieldContainer.setOutputMarkupId(true); // textfield to show with isVisible redifined based on previous model final TextField textField = new TextField("text") { @Override public boolean isVisible() { return yesNoState.getObject(); } }; fieldContainer.add(textField); // just a component to agrupate options RadioGroup yesNoGroup = new RadioGroup("yesNoGroup", yesNoState); yesNoGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { // this is to update container by ajax and consequently textField visibility. target.addComponent(fieldContainer); } }); yesNoGroup.add(new Radio("yes", Model.of(Boolean.TRUE)), new Radio("no", Model.of(Boolean.FALSE))); add(fieldContainer); add(yesNoGroup); I hope that helps you. Bye Norberto 2011/11/20 ridaa > Hey thanx alot ...!! > It would be really very helpful if i could get some explanation on above > code. > > Regards. > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Radio-button-selection-tp4085827p4088663.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: Radio button selection
Hey thanx alot ...!! It would be really very helpful if i could get some explanation on above code. Regards. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Radio-button-selection-tp4085827p4088663.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Radio button selection
Just an idea :) private final IModel yesNoState = new Model(); final TextField textField = new TextField("text", ...); textField.setOutputMarkupId(true); ... add(new AbstractBehavior() { @Override public void configure(Component component) { component.setVisible(Boolean.TRUE.equals(yesNoState.getObject())); } }); add(textField); RadioGroup yesNoGroup = new RadioGroup("yesNoGroup", yesNoState ); yesNoGroup.add(AjaxFormChoiceComponentUpdatingBehavior()) { @Override protected void onUpdate(AjaxRequestTarget target) { textField.setVisible(Boolean.TRUE.equals(yesNoState.getObject())); target.addComponent(textField); } }); add(yesNoGroup); yesNoGroup.add(new Radio("yes", Model.of(Boolean.TRUE)); yesNoGroup.add(new Radio("no", Model.of(Boolean.FALSE)); And markup: - -- http://www.linkedin.com/in/amorozov -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Radio-button-selection-tp4085827p4088304.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Radio button selection
Hi Please provide me with some hints on below issue: I want to displaying a text field based radio button selection. If selected "yes"- a text field . If selected "NO"-say a label text field. How do i get the value of the current radio selection,so that based on it i can use mark ups. Thanks & Regards. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Radio-button-selection-tp4085827p4085827.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: radio button example help
Hi, wmike1...@gmail.com wrote: > > How is the current selection recognized? > the RadioChoice get's a PropertyModel from the CompoundPropertyModel automagically. You could do it explicitely like the following: new RadioChoice("site", new PropertyModel(input, "site"), SITES); wmike1...@gmail.com wrote: > > Why does the compound property model (the Input object) not have any > getters/setters? > Wicket's property resolver uses field access if no getter/setter is present. Hope this helps Sven -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/radio-button-example-help-tp3710953p3711589.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
radio button example help
This code is from the wicket examples: I'm having a lot of trouble understanding it. How is the current selection recognized? Why does the compound property model (the Input object) not have any getters/setters? package org.apache.wicket.examples.compref; import java.util.Arrays; import java.util.List; import org.apache.wicket.IClusterable; import org.apache.wicket.examples.WicketExamplePage; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.RadioChoice; import org.apache.wicket.markup.html.panel.FeedbackPanel; import org.apache.wicket.model.CompoundPropertyModel; /** * Page with examples on {@link org.apache.wicket.markup.html.form.ListChoice}. * * @author Eelco Hillenius */ public class RadioChoicePage extends WicketExamplePage { /** available sites for selection. */ private static final List SITES = Arrays.asList(new String[] { "The Server Side", "Java Lobby", "Java.Net" }); /** * Constructor */ public RadioChoicePage() { final Input input = new Input(); setModel(new CompoundPropertyModel(input)); // Add a FeedbackPanel for displaying our messages FeedbackPanel feedbackPanel = new FeedbackPanel("feedback"); add(feedbackPanel); // Add a form with an onSumbit implementation that sets a message Form form = new Form("form") { protected void onSubmit() { info("input: " + input); } }; add(form); // Add a radio choice component that uses Input's 'site' property to // designate the // current selection, and that uses the SITES list for the available // options. form.add(new RadioChoice("site", SITES)); } /** Simple data class that acts as a model for the input fields. */ private static class Input implements IClusterable { /** the selected site. */ public String site = (String)SITES.get(0); /** * @see java.lang.Object#toString() */ public String toString() { return "site = '" + site + "'"; } } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/radio-button-example-help-tp3710953p3710953.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Radio button question
> From: igor.vaynb...@gmail.com > Date: Mon, 6 Jul 2009 19:10:22 -0700 > Subject: Re: Radio button question > To: users@wicket.apache.org > > the example of radiogroup in wicket-examples/component reference > demonstrates a radio group with a variable amount of radios. > > -igor > Igor, Thank you - this is the link I found and seems just what I was looking for http://wicketstuff.org/wicket13/compref/;jsessionid=A9F9170F03765B6C9DEE45A31E5FA494?wicket:bookmarkablePage=:org.apache.wicket.examples.compref.RadioGroupPage Thanks, Russ _ Hotmail® has ever-growing storage! Don’t worry about storage limits. http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009
Re: Radio button question
the example of radiogroup in wicket-examples/component reference demonstrates a radio group with a variable amount of radios. -igor On Mon, Jul 6, 2009 at 6:07 PM, Russell Simpkins wrote: > > All, > I want to display a radio button of options with an associated image e.g. > ..> ..> > And have those values driven from my Model. I feel caught somewhere between > RadioGroup and RadioList but I'm not sure how to pull this off because > RadioGroup documentation seems to suggest that I have to have wicket:id= for > each radio option, and I won't know how many options since its database > driven. RadioList does the radio options fine, but I can't figure out how to > render the image. > I am using a RadioList and an implementation of IChoiceRenderer. I tried > adding the image html to the getDisplayValue method, but the image would not > render. > I'm still new to Wicket so I may have missed this in the docs, if so feel > free to paste link to any example or doc that I should have read closer :-) > Thanks in advance, > Russ > _ > Windows Live™ SkyDrive™: Get 25 GB of free online storage. > http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Radio button question
All, I want to display a radio button of options with an associated image e.g. And have those values driven from my Model. I feel caught somewhere between RadioGroup and RadioList but I'm not sure how to pull this off because RadioGroup documentation seems to suggest that I have to have wicket:id= for each radio option, and I won't know how many options since its database driven. RadioList does the radio options fine, but I can't figure out how to render the image. I am using a RadioList and an implementation of IChoiceRenderer. I tried adding the image html to the getDisplayValue method, but the image would not render. I'm still new to Wicket so I may have missed this in the docs, if so feel free to paste link to any example or doc that I should have read closer :-) Thanks in advance, Russ _ Windows Live™ SkyDrive™: Get 25 GB of free online storage. http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009
Re: How to test AjaxFormChoiceComponentUpdatingBehavior for Radio Button
That's what we are using here: public static void selectAjaxRadio(final WicketTester tester, final String radioPath) { final Radio radio = (Radio) tester.getComponentFromLastRenderedPage(radioPath); final RadioGroup radioGroup = radio.findParent(RadioGroup.class); AjaxFormChoiceComponentUpdatingBehavior behavior = null; for (final IBehavior b : radioGroup.getBehaviors()) { if (b instanceof AjaxFormChoiceComponentUpdatingBehavior) { behavior = (AjaxFormChoiceComponentUpdatingBehavior) b; break; } } assert behavior != null; final CharSequence url = behavior.getCallbackUrl(false); final WebRequestCycle cycle = tester.setupRequestAndResponse(true); tester.getServletRequest().setRequestToRedirectString(url.toString()); tester.getServletRequest().setParameter( radioGroup.getInputName(), radio.getValue() ); tester.processRequestCycle(cycle); } Yep, it looks weird. But works. If you have less hacky solutions, please, tell us. 2009/4/30 Jeffrey S. Schwartz : > I have the same question as the reader from this email: > http://www.nabble.com/How-to-test-AjaxFormChoiceComponentUpdatingBehavior-for-Radio-Button-p21833782.html > > I scoured the mailing lists, wiki and the javadoc for a possible > solution. I have attached a quick-start application that shows the > problem. When I run the application the > AjaxFormChoiceComponentUpdatingBehavior works as expected! However, > when I run the unit test and use the tester.executeBehavior method to > call the AjaxFormChoiceComponentUpdatingBehavior, the model is always > null. A snippet of my unit test is below: > > FormTester form = tester.newFormTester("form"); > System.out.println("form.modelObject=" + > form.getForm().getModelObject()); > form.select("radioButtons", 1); > form.submit(); > System.out.println("form.modelObject=" + > form.getForm().getModelObject()); > > Component comp = form.getForm().get("radioButtons"); > > List behaviors = comp.getBehaviors(); > for (IBehavior i: behaviors) { > if (i instanceof AjaxFormChoiceComponentUpdatingBehavior) { > AjaxFormChoiceComponentUpdatingBehavior a = > (AjaxFormChoiceComponentUpdatingBehavior)i; > //executes the behavior, but clears the object's model > tester.executeBehavior(a); > } > } > > > Any suggestions would be very helpful. > > I am using wicket 1.4-rc2. > > Thanks in advance. > > -Jeff > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to test AjaxFormChoiceComponentUpdatingBehavior for Radio Button
I have the same question as the below reader. I scoured the mailing lists, wiki and the javadoc. I have attached a quick-start application that shows the problem. When I run the application the AjaxFormChoiceComponentUpdatingBehavior works as expected! However, when I run the unit test and use the tester.executeBehavior method to call the AjaxFormChoiceComponentUpdatingBehavior, the model is always null. A snippet of my unit test is below: FormTester form = tester.newFormTester("form"); System.out.println("form.modelObject=" + form.getForm().getModelObject()); form.select("radioButtons", 1); form.submit(); System.out.println("form.modelObject=" + form.getForm().getModelObject()); Component comp = form.getForm().get("radioButtons"); List behaviors = comp.getBehaviors(); for (IBehavior i: behaviors) { if (i instanceof AjaxFormChoiceComponentUpdatingBehavior) { AjaxFormChoiceComponentUpdatingBehavior a = (AjaxFormChoiceComponentUpdatingBehavior)i; //executes the behavior, but clears the object's model tester.executeBehavior(a); } } Any suggestions would be very helpful. I am using wicket 1.4-rc2. Thanks in advance. -Jeff http://www.nabble.com/file/p23302320/FormQuestion.zip FormQuestion.zip techisbest wrote: > > I have a RadioGroup with two Radio buttons inside a Form in a Panel. I > have created an AjaxFormChoiceComponentUpdatingBehavior that has been > added to the RadioGroup. This behavior is working fine and I am able to > update my Session with the new values when the user switches between the > Radio buttons. > > I am having difficulty creating a Wicket test for this behavior. I can > not seem to invoke the behavior when selecting a new button via the > FormTester for the panel containing the form. I saw one thread here that > suggested (by the user asking the original question) using > tester.getLastRenderedPage().getBehaviors() to get at the behavior I want > to execute via tester.executeBehavior. But the getBehaviors method is > returning an empty list. > > Can someone please tell me how to test this behavior? > -- View this message in context: http://www.nabble.com/How-to-test-AjaxFormChoiceComponentUpdatingBehavior-for-Radio-Button-tp21833782p23302320.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: radio button ajax behaviour
I suggest using the "onclick" event instead. In Internet Explorer, the "onchange" event does not work for radio buttons. -- Matt dtoffe wrote: > > Have you tried with an AjaxEventBehavior and an "onchange" event ? See > the javadocs for AjaxEventBehavior. > > Daniel > > > SrinivasaRaju Ch wrote: >> >> Hi, >> >> I am unable to apply ajax behaviour to radio button. I want my >> components to be shown and hide with RadioChoice. >> >> >> Regards, >> Srinivasa Raju CH. >> >> > > -- View this message in context: http://www.nabble.com/radio-button-ajax-behaviour-tp22659660p22668668.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: radio button ajax behaviour
Have you tried with an AjaxEventBehavior and an "onchange" event ? See the javadocs for AjaxEventBehavior. Daniel SrinivasaRaju Ch wrote: > > Hi, > > I am unable to apply ajax behaviour to radio button. I want my > components to be shown and hide with RadioChoice. > > > Regards, > Srinivasa Raju CH. > > -- View this message in context: http://www.nabble.com/radio-button-ajax-behaviour-tp22659660p22662062.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
radio button ajax behaviour
Hi, I am unable to apply ajax behaviour to radio button. I want my components to be shown and hide with RadioChoice. Regards, Srinivasa Raju CH. Get your world in your inbox! Mail, widgets, documents, spreadsheets, organizer and much more with your Sifymail WIYI id! Log on to http://www.sify.com ** DISCLAIMER ** Information contained and transmitted by this E-MAIL is proprietary to Sify Limited and is intended for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If this is a forwarded message, the content of this E-MAIL may not have been sent with the authority of the Company. If you are not the intended recipient, an agent of the intended recipient or a person responsible for delivering the information to the named recipient, you are notified that any use, distribution, transmission, printing, copying or dissemination of this information in any way or in any manner is strictly prohibited. If you have received this communication in error, please delete this mail & notify us immediately at ad...@sifycorp.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Reg Radio button
in your form.onsubmit() you can check the value of the model - which will give you the selected option. -igor On Fri, Feb 13, 2009 at 9:54 AM, Swapna Rachamalla wrote: > Hi All > > I have a Radio button group For eg imagine > > Country: > > - USA > - UK > - etc > > If one of the country is selected i want to write logic( if any one of the > option is selected.) > which method i have to override for this.( For eg if we have a link then we > override the method onClick() and if it is a form we override onSubmit() ).. > > Thanks > Swapna > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Reg Radio button
Hi All I have a Radio button group For eg imagine Country: - USA - UK - etc If one of the country is selected i want to write logic( if any one of the option is selected.) which method i have to override for this.( For eg if we have a link then we override the method onClick() and if it is a form we override onSubmit() ).. Thanks Swapna
How to test AjaxFormChoiceComponentUpdatingBehavior for Radio Button
I have a RadioGroup with two Radio buttons inside a Form in a Panel. I have created an AjaxFormChoiceComponentUpdatingBehavior that has been added to the RadioGroup. This behavior is working fine and I am able to update my Session with the new values when the user switches between the Radio buttons. I am having difficulty creating a Wicket test for this behavior. I can not seem to invoke the behavior when selecting a new button via the FormTester for the panel containing the form. I saw one thread here that suggested (by the user asking the original question) using tester.getLastRenderedPage().getBehaviors() to get at the behavior I want to execute via tester.executeBehavior. But the getBehaviors method is returning an empty list. Can someone please tell me how to test this behavior? -- View this message in context: http://www.nabble.com/How-to-test-AjaxFormChoiceComponentUpdatingBehavior-for-Radio-Button-tp21833782p21833782.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Adding Ajax behavior on radio button
Or you can try http://www.nabble.com/-Question--wicket.markup.html.form.Radio-tf3926549.html#a11160274 this jq58 wrote: > . > > This looks like it's 1.3, I'm on 1.2.6. > > Is it 1.3? > > Maybe AjaxEventBehavior(onchange) could help? > It seems to be acting erratic though. > > I can get to the onEvent method on on button, but not the other. Have > exactly the same onEvent method set up on both radio buttons (which are > part of a radio group). > > > > igor.vaynberg wrote: >> >> see AjaxFormChoiceComponentUpdatingBehavior >> >> -igor >> >> >> On 8/8/07, jq58 <[EMAIL PROTECTED]> wrote: >>> >>> >>> I have a 2 radio buttons that enable a dropdown and a text field >>> respectively. Thus, depending on which radio button is selected, either >>> the >>> dropdown or the text field is enabled. >>> >>> Thus I need ajax capability when a radio button is selected, but >>> evidently >>> this can't happen in Wicket, because, for some reason, the radio button >>> is >>> not a FormComponent (new AjaxFormComponentUpdatingBehavior(), not new >>> AjaxComponentUpdatingBehavior() is available). >>> >>> What is the best way to get around this? >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/Adding-Ajax-behavior-on-radio-button-tf4238831.html#a12061159 >>> Sent from the Wicket - User mailing list archive at Nabble.com. >>> >>> >>> - >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/Adding-Ajax-behavior-on-radio-button-tf4238831.html#a12067079 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding Ajax behavior on radio button
yes it is 1.3 only, you can probably just copy and paste it into your own project -igor On 8/8/07, jq58 <[EMAIL PROTECTED]> wrote: > > > This looks like it's 1.3, I'm on 1.2.6. > > Is it 1.3? > > Maybe AjaxEventBehavior(onchange) could help? > It seems to be acting erratic though. > > I can get to the onEvent method on on button, but not the other. Have > exactly the same onEvent method set up on both radio buttons (which are > part of a radio group). > > > > igor.vaynberg wrote: > > > > see AjaxFormChoiceComponentUpdatingBehavior > > > > -igor > > > > > > On 8/8/07, jq58 <[EMAIL PROTECTED]> wrote: > >> > >> > >> I have a 2 radio buttons that enable a dropdown and a text field > >> respectively. Thus, depending on which radio button is selected, > either > >> the > >> dropdown or the text field is enabled. > >> > >> Thus I need ajax capability when a radio button is selected, but > >> evidently > >> this can't happen in Wicket, because, for some reason, the radio button > >> is > >> not a FormComponent (new AjaxFormComponentUpdatingBehavior(), not new > >> AjaxComponentUpdatingBehavior() is available). > >> > >> What is the best way to get around this? > >> > >> -- > >> View this message in context: > >> > http://www.nabble.com/Adding-Ajax-behavior-on-radio-button-tf4238831.html#a12061159 > >> Sent from the Wicket - User mailing list archive at Nabble.com. > >> > >> > >> - > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > > -- > View this message in context: > http://www.nabble.com/Adding-Ajax-behavior-on-radio-button-tf4238831.html#a12062792 > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: Adding Ajax behavior on radio button
This looks like it's 1.3, I'm on 1.2.6. Is it 1.3? Maybe AjaxEventBehavior(onchange) could help? It seems to be acting erratic though. I can get to the onEvent method on on button, but not the other. Have exactly the same onEvent method set up on both radio buttons (which are part of a radio group). igor.vaynberg wrote: > > see AjaxFormChoiceComponentUpdatingBehavior > > -igor > > > On 8/8/07, jq58 <[EMAIL PROTECTED]> wrote: >> >> >> I have a 2 radio buttons that enable a dropdown and a text field >> respectively. Thus, depending on which radio button is selected, either >> the >> dropdown or the text field is enabled. >> >> Thus I need ajax capability when a radio button is selected, but >> evidently >> this can't happen in Wicket, because, for some reason, the radio button >> is >> not a FormComponent (new AjaxFormComponentUpdatingBehavior(), not new >> AjaxComponentUpdatingBehavior() is available). >> >> What is the best way to get around this? >> >> -- >> View this message in context: >> http://www.nabble.com/Adding-Ajax-behavior-on-radio-button-tf4238831.html#a12061159 >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > -- View this message in context: http://www.nabble.com/Adding-Ajax-behavior-on-radio-button-tf4238831.html#a12062792 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Adding Ajax behavior on radio button
see AjaxFormChoiceComponentUpdatingBehavior -igor On 8/8/07, jq58 <[EMAIL PROTECTED]> wrote: > > > I have a 2 radio buttons that enable a dropdown and a text field > respectively. Thus, depending on which radio button is selected, either > the > dropdown or the text field is enabled. > > Thus I need ajax capability when a radio button is selected, but evidently > this can't happen in Wicket, because, for some reason, the radio button is > not a FormComponent (new AjaxFormComponentUpdatingBehavior(), not new > AjaxComponentUpdatingBehavior() is available). > > What is the best way to get around this? > > -- > View this message in context: > http://www.nabble.com/Adding-Ajax-behavior-on-radio-button-tf4238831.html#a12061159 > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: Adding Ajax behavior on radio button
you could probably go with an all javascript solution, although i don't know if that confuses client- and serverside state. so, when a radiobutton gets clicked, you enable the particular component and disable the other. gerolf On 8/8/07, jq58 <[EMAIL PROTECTED]> wrote: > > > I have a 2 radio buttons that enable a dropdown and a text field > respectively. Thus, depending on which radio button is selected, either > the > dropdown or the text field is enabled. > > Thus I need ajax capability when a radio button is selected, but evidently > this can't happen in Wicket, because, for some reason, the radio button is > not a FormComponent (new AjaxFormComponentUpdatingBehavior(), not new > AjaxComponentUpdatingBehavior() is available). > > What is the best way to get around this? > > -- > View this message in context: > http://www.nabble.com/Adding-Ajax-behavior-on-radio-button-tf4238831.html#a12061159 > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Adding Ajax behavior on radio button
I have a 2 radio buttons that enable a dropdown and a text field respectively. Thus, depending on which radio button is selected, either the dropdown or the text field is enabled. Thus I need ajax capability when a radio button is selected, but evidently this can't happen in Wicket, because, for some reason, the radio button is not a FormComponent (new AjaxFormComponentUpdatingBehavior(), not new AjaxComponentUpdatingBehavior() is available). What is the best way to get around this? -- View this message in context: http://www.nabble.com/Adding-Ajax-behavior-on-radio-button-tf4238831.html#a12061159 Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]