You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Robert Lamping <ro...@logicacmg.com> on 2003/10/03 16:37:24 UTC

Master Detail: Problem committing Master while link to Detail

Dear all,

I am using one form <html:form>...  which contains the master information of
1 record.
Within that form I show the details of linked records. Something like order
and orderdetails records.

The master records can be edited and there are two buttons: Save and Cancel.
The details records are listed only and i am using <a href ...> to link to
the screen with the information of the details record.

I am using Struts Validator and currently have no separate validate method
in my Form"bean"
In th actionmapping I set validate=true
I don't use Javascript to do a prevalidation.

Schematic example:
----------------------------------------------------
Order : ___________

Save Cancel


List of orderitems

1.  Item1            and then with hrefs: Show / Delete
2. Item 2            Show / Delete.
----------------------------------------------------

I have two problems. 

1. 
The cancel-button still validates. The isCancelled() method does not seem to
work. I call it in the method executeAction of this screen.
How can I pre-empt the validation?

2.
When I modify information in the master part adn I what to a detail-screen,
then I want the master part to be commited first, before I go to this
detailscreen. 
The links to these items are set up using the format:
href="./orderitem.do?id=num   where num is the actual unique code in the
database of this item..
Of course leaving the page using href, will not commit the master part. My
question is: How can I make it happen? (commit the master first and then go
the detail).

Hope you can help,
Kind regards,

Robert Lamping


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Master Detail: Problem committing Master while link to Detail

Posted by Ted Husted <hu...@apache.org>.
Robert Lamping wrote:
> 1. 
> The cancel-button still validates. The isCancelled() method does not seem to
> work. I call it in the method executeAction of this screen.
> How can I pre-empt the validation?

Are you using the html tag to create the cancel button. The button needs 
to be set to a magic value to work, which the tags spits out for you.

> 2.
> When I modify information in the master part adn I what to a detail-screen,
> then I want the master part to be commited first, before I go to this
> detailscreen. 
> The links to these items are set up using the format:
> href="./orderitem.do?id=num   where num is the actual unique code in the
> database of this item..
> Of course leaving the page using href, will not commit the master part. My
> question is: How can I make it happen? (commit the master first and then go
> the detail).

I try very hard to avoid this page design myself, for the reason stated. 
Typically, I will show the master and child in a view format, and then 
let them edit the master or a child. Whenever possible, I avoid putting 
any link tags on the same screen as an edit dialog, since it encourages 
people to link off without submitting their change. :(

If you must display the form this way, the only recourse is to change 
the links so that they also submit the form, either through JavaScript 
or by making the links buttons. The Action can then save any changes to 
the form, and then forward on to the other detail page.

HTH, Ted.



-- 
Ted Husted,
   Junit in Action  - <http://www.manning.com/massol/>,
   Struts in Action - <http://husted.com/struts/book.html>,
   JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org