Re: Submitting multiple instances in one WOForm
Re: Submitting multiple instances in one WOForm
- Subject: Re: Submitting multiple instances in one WOForm
- From: David Avendasora <email@hidden>
- Date: Tue, 10 Apr 2007 08:18:27 -0500
Okay, I added a setQuantityToSchedule method, but I still get the
NullPointerExeption.
Here's the method I'm actually calling in the action binding of the
WOSubmitButton:
public WOComponent addOrderItemToSchedule() {
ec = session().defaultEditingContext();
log.debug("OrderItem to Schedule: "+aOrderItem.part().partName());
((ManufacturingSchedule)manufacturingSchedule).scheduleOrderItem(ec,
(OrderItem)aOrderItem,
quantityToSchedule);
return context().page();
}
I get a NullPointerException on the log.debug statement, or if I
comment it out, on the scheduleOrderItem() call.
Here's the bindings of the WOTextField:
quantityToSchedule: WOTextField {
numberformat = "0";
size = 5;
value = quantityToSchedule;
class = "small";
}
What am I missing? Why does this work just fine if I have one form
for each aOrderItem, but when I try to have one form for ALL of them,
I get the NullPointerException.
Dave
On Apr 10, 2007, at 7:20 AM, Daniele Corti wrote:
2007/4/10, David Avendasora <email@hidden>:
On Apr 10, 2007, at 6:02 AM, Daniele Corti wrote:
2007/4/10, David Avendasora < email@hidden>: Hi all,
I have a component in my app that had a WOForm nested inside a
WORepetition to submit OrderItems to a manufacturing schedule. One
form for each OrderItem, each with it's own submit button. I thought
I could make the page much more efficient (from both the user's and
the application's perspective) by having just one form that the user
selects which items they want scheduled. The way they indicate what
OrderItems they want scheduled is by changing an item's
quantityToSchedule from null to some quantity.
In wicth way?
The only form field in the form is the repeated quantityToSchedule.
Ok, and what kind of form element is it? input Text? Select?
Submit button?
It is a simple text input field that is empty when the page is
drawn, but they can add a value to if they want it put on the
schedule.
The quantityToSchedule value is NOT an attribute of OrderItem, and
I'm not actually updating OrderItem, I am using the information from
the submitted form to create new instances of the ScheduledOrderItem
entity.
When I submit the form, I get a null pointer exception when I try to
pass the instance of OrderItem that is bound to the WORepitition's
"item" binding (aOrderItem). Am I doing something obviously wrong?
mmm, sorry but I've not understand very well the structure of your
form, ca you give a little example?
<WOForm>
<WOSubmitButton action=scheduleOrderItem>
<WORepetition list=openOrderItems, item=aOrderItem>
<WOString value=aOrderItem.Order.DueDate>,<WOString
value=aOrderItem.Part.PartName>,<WOString
value=aOrderItem.orderQuantity><WOTextField value=quantityToSchedule>
</WORepitition>
</WOForm>
In the component.java file I have have the following variable and
method:
protected BigDecimal quantityToSchedule();
quantityToSchedule() {
return null;
}
ehm, I think you miss the setQuantityToSchedule(BigDecimal decimal)
method
for example:
private BigDecimal _quantityToSchedule;
public BigDecimal quantityToSchedule()
{
return _quantityToSchedule;
}
public void setQuantityToSchedule(BigDecimal decimal)
{
_quantityToSchedule = decimal;
}
then when you bind <WOTextField value=quantityToSchedule> this
should work!
Thanks,
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ( email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
--
Daniele Corti
AIM: S0CR4TE5
Messenger: email@hidden
--
Daniele Corti
AIM: S0CR4TE5
Messenger: email@hidden
_______________________________________________
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