Re: Default values for new objects d2w
Re: Default values for new objects d2w
- Subject: Re: Default values for new objects d2w
- From: Ramsey Lee Gurley <email@hidden>
- Date: Mon, 14 Sep 2009 20:32:19 -0400
Yep, that's your problem :-)
The submit action attempts to save before calling next page. Try
setting the relationship as you go into the edit page. How are you
getting in there? Also, are child and parent the same or different
entities?
Ramsey
On Sep 14, 2009, at 10:30 AM, Freddie Tilley wrote:
When I try it with a next page delegate, the validation fails before
it reaches the NextPageDelegate because the parent property is not
allowed to be null.
I set the next page delegate for the edit page.
--
Freddie Tilley
2009/9/14 Anjo Krank <email@hidden>
Plz stay on the list.
I'd guess that you would be better suited of you used a
NextPageDelegate for that. Sth like:
public static class PickToOneRelationshipDelegate implements
NextPageDelegate {
public WOComponent prev;
public String relkey;
public EOEnterpriseObject eo;
public EORelationship rel;
public PickToOneRelationshipDelegate(WOComponent nextPage,
EOEnterpriseObject eo, String relkey) {
this.prev = nextPage;
this.relkey = relkey;
this.eo = eo;
}
public WOComponent nextPage(WOComponent sender) {
NSArray selectedObjects = (NSArray) sender.valueForKeyPath
("selectedObjects");
if (selectedObjects != null && selectedObjects.count() ==
1) {
eo.takeValueForKey(selectedObjects.objectAtIndex(0),
relkey);
} else {
eo.takeValueForKey(null, relkey);
}
return prev;
}
}
You'd have an action displaying a select or create page (for use of
ERDActionBar check bug tracker) and an instance of the above is set
as the nextPageDelegate (or whatever you wanna do).
Cheers, Anjo
Am 14.09.2009 um 13:55 schrieb Freddie Tilley:
2009/9/14 Anjo Krank <email@hidden>
Depends on whatcha wanna do. Normally, one needs to set the current
user, set the creation date and so forth. If you want that, you
could override ERXGenericRecord.init() and get the user from Thread
storage where you previously put it in session.awake(). Look at the
bug tracker example on how to do that.
If you *really* want default values calculated by rules, this is
also possible, but I'd strongly recommend against it and won't say
anything until you make a good case for you needing it :)
Cheers, Anjo
Well, I have a parent class and a child class.
I would like an overview all the parents children in a list page,
instead of the edit relationship page.
When creating a new child instance from this page, I automatically
want to assign the parent to the child class.
Then I can hide the child->parent relationship property from the
edit page, since this is not allowed to be changed.
--
Freddie Tilley
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@mac.com
This email sent to email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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