Problem with radiobutton and selection evaluation
Problem with radiobutton and selection evaluation
- Subject: Problem with radiobutton and selection evaluation
- From: Dev WO <email@hidden>
- Date: Wed, 20 Oct 2004 19:37:59 +0200
Hi,
it might be something very simple but I just can't figure it out by myself...
I have two radiobutton in a form with a value of 1 and 2.
I'd like to make an evaluation within my form validation method to change the 1 or 2 with a specific (non-dynamic) string and make a different calculation depending on the selection value.
here's the code for my validation method:
-----
protected String orderSelection;
protected Object orderType;
protected int orderQuantity;
protected int shippingCost;
protected int totalCost;
protected Object paymentSelection;
protected String paymentType;
public boolean entryIncomplete;
.......
public WOComponent validateOrder()
{
if (orderSelection == "1")
{
if (orderQuantity < 4)
{
orderType = "des cartes à l'unité";
shippingCost = 10;
totalCost = shippingCost+(99*orderQuantity);
}
if ((orderQuantity > 3) && (orderQuantity < 11))
{
orderType = "des cartes à l'unité";
shippingCost = 15;
totalCost = shippingCost+(99*orderQuantity);
}
if (orderQuantity > 10)
{
orderType = "des cartes à l'unité";
shippingCost = 2*orderQuantity;
totalCost = shippingCost+(99*orderQuantity);
}
}
if (orderSelection == "2")
{
orderType = "des cartes par pack de 25";
shippingCost = 15*orderQuantity;
totalCost = shippingCost+(2375*orderQuantity);
}
if (paymentSelection == "3")
{
paymentType = "par chèque";
}
if (paymentSelection == "4")
{
paymentType = "par carte bancaire";
}
entryIncomplete = false;
return null;
}
-----
But it just don't give anything. It seems that the evaluation are all evaluate to false...
But if I just add:
----
orderType = orderSelection;
----
at the end of the method, I get either 1 or 2...So I don't understand why it doesn't evaluate correctly (I mean I don't know how to make it work, I know it's my fault and not Java's one;))
Thanks for your help, I'm still learning;)
Xavier
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden