Am 20.09.2007 um 17:37 schrieb Daniele Corti:
2007/9/20, Johann Werner <[EMAIL PROTECTED]>:
Hi all,
I have a weird behaviour of takeValuesFromRequest. I have a page with
a form that has a radio button group having values from 1 to n.
<woform>
<worepetition>
<radiobutton>
</worepetition>
</woform>
with
radiobutton : WORadioButton {
name = "reportSelect";
value = counter;
selection = selectedReport;
}
gives
<form name="form_0_0_3_25_5" method="post" action="...">
<input type="radio" value="1" name="reportSelect">
<input type="radio" value="2" name="reportSelect">
<input type="radio" value="3" name="reportSelect">
...
<input type="submit" name="0.0.3.25.5.7.0">
</form>
selectedReport is an int variable that is set to 0 in
appendToResponse. When I select one of the radiobuttons and submit
the form I get the appropriate value in selectedReport for all radio
buttons except for the first one. That is if I select the first one
the value of selectedReport in my form action is 0 and not 1 as I
would expect.
I added takeValuesFromRequest to my component and by checking the
form values in WORequest I can see that the value 1 is there but I
don't know why just that value is not assigned to the variable. The
only way I found to make this work is to add
if (aRequest.formValueForKey("reportSelect") != null) {
selectedReport = new Integer((String)aRequest.formValueForKey
("reportSelect")).intValue();
}
to takeValuesFromRequest to manually assign the value. But it should
not be necessary to do so! So does anyone have an idea what is going
wrong or did someone else observe that behaviour?
I could make a mistack but I think radio button take only String
value, try use selectedReport as String
changed it to String and when I select the first radio button no value gets into the variable as before and by selecting one of the other buttons I get:
<com.webobjects.appserver._private.WOComponentRequestHandler>: Exception occurred while handling request: java.lang.IllegalArgumentException: While trying to set the field "selectedReport" on an object of type com.oyosys.source.administration.AdminNewVersion we expected a java.lang.String but received a java.lang.Integer with a value of 2. This often happens if you forget to use a formatter.
So I could use a formatter to prevent this error but this doesn't change the fact that for selecting button No. 1 no assignement seems to be made in takeValuesFromRequest for whatever reason. :-(
jw
jw _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription:http://lists.apple.com/mailman/options/webobjects-dev/ildenae% 40gmail.comThis email sent to [EMAIL PROTECTED] -- Daniele Corti AIM: S0CR4TE5 Messenger: [EMAIL PROTECTED] --Computers are like air conditioners -- they stop working properly if you openWINDOWS -- What about the four lusers of the apocalypse? I nominate: "advertising", "can't log in", "power switch" and "what backup?" --Alistair Young
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
