Re: WOForm Question
Re: WOForm Question
- Subject: Re: WOForm Question
- From: Chuck Hill <email@hidden>
- Date: Tue, 3 Apr 2007 13:49:39 -0700
Maybe post some of the HTML and WOD files.
On Apr 3, 2007, at 1:41 PM, David Avendasora wrote:
Yes, it is Routing <--->> RoutingStep, but the form I'm working on
is only for editing existing and existing Routing. By it's nature,
every (it's required in the EOModel) Routing has at least 1
RoutingStep.
I have a form that displays everything correctly and everything
seems to be bound properly, but when I submit the form, I get a
nullPointerException on the aRoutingStep.setAttribute(attribute);
call. The currentRouting.setAttribute(attribute); call works
perfectly.
Again, the page builds properly with all the current values in the
WOTextFields and WOPopUpButtons but when I try to submit the form,
I get the nullPointerException.
Dave
On Apr 3, 2007, at 3:19 PM, Robert Walker wrote:
David,
What does your model look like? Is it something like:
Routing <-------->> RoutingStep
With a relationship from Routing to RoutingStep named routingSteps.
Guessing here, but I suppose you have a form for entering
information on an instance of Route:
Now your are trying to update an attribute of RoutingStep with a
binding like:
currentRoute.routingSteps.someAttribute
If my guess is correct, well you can't do that because
"currentRoute.routingSteps" would return "null" if there are no
routing steps. I'm making this assumption because I've seen
beginners to WO try this.
There are a few options for dealing with this case. But most
would include creating an interface to display the array of
routingSteps and actions to add and remove routing steps from the
array. You also need to properly manage the to-many relationship
when adding and removing. Generally using
addObjectToBothSidesOfRelationshipWithKey.
Once you are able to iterate over your routingSteps relationship
then you can bind your form controls to "currentRoutingStep" or
whatever you decide to call the iterator reference.
On Apr 3, 2007, at 3:39 PM, David Avendasora wrote:
Okay, it isn't a nesting problem on the web-component side of
things. I think it is a problem with how I'm stepping through the
objects to update them. Simple attributes and to-one
relationships are easy, to-many relationship updates have me
stumped.
Can anyone give me an example of how to iterate through the
related objects and update them with the values submitted in the
form?
Thanks,
Dave
On Apr 3, 2007, at 2:19 PM, Chuck Hill wrote:
On Apr 3, 2007, at 12:12 PM, David Avendasora wrote:
Okay, I have one form on the page. One submit button in the form.
It will update the attributes of "Routing" (the top level
component) but as soon as I try to update attributes of
destination of the to-many relationship (RoutingStep) I get a
java.lang.NullPointerException. The object that it is finding
to be null is the aRoutingStep object that is the "item"
binding of the WORepetition. The "list" binding of the
WORepetition is aRouting.routingSteps.
Am I missing something?
A nesting problem?
<webobject name="Repetition">
....
<!-- here the value of the item binding of Repetition is
guaranteed to have a valid value --:>
...
</webobject name="Repetition">
<!-- here the value of the item binding of Repetition is
guaranteed to be null --:>
Chuck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
--
Robert Walker
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:
40avendasora.com
This email sent to 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:
40global-village.net
This email sent to email@hidden
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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