David, You may want to consider using ERD2WUtilities to find the edit page. That way, if you later decide to use this delegate on an embedded edit page, it will still get the correct edit page and object. Or just use branch delegates everywhere, then there's less murky guesswork (^_^)
Ramsey
On Mar 29, 2011, at 5:12 PM, David Holt wrote:
> This may help someone else in the future.
>
> There is a way to see whether the cancel or save button was used to get to
> the nextPageDelegate:
>
> public WOComponent nextPage(WOComponent sender) {
> // set up for branching based on whether the cancel button, or the save
> // button was pressed
> D2WPage page = (D2WPage) sender.context().page();
> EOEnterpriseObject eo = page.object();
> // a null editing context means that the cancel button was pressed
> if (eo.editingContext() == null) {
> return ((Session) sender.session()).navController().listAreas();
> }
> // otherwise, the save button was pressed
> else {
> Area ca = (Area) eo;
> ((Session) sender.session()).setSelectedArea(ca);
> EOEditingContext ec = ca.editingContext();
> EditPageInterface epi =
> editPageForNewObjectWithConfigurationNamed("CreateItem", sender.session(),
> ca, Person.currentUser(ec), ec);
> return (WOComponent) epi;
> }
>
> }
>
>
> On 2011-03-29, at 3:10 PM, David Holt wrote:
>
>> I am trying out a nextPageDelegate for an object Create page and I am
>> finding it applies to both the "Cancel" button and "Save" button. I am happy
>> with the default nextPage() on the Cancel action, but would like to create a
>> page that is different from the default after a successful save. How does
>> one handle this case?
>>
>> Thanks,
>>
>> David _______________________________________________
>> 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/programmingosx%40mac.com
>>
>> This email sent to [email protected]
>
> _______________________________________________
> 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/ramseygurley%40gmail.com
>
> This email sent to [email protected]
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]
