On 3/10/06, Danny Lee <[EMAIL PROTECTED]> wrote: > Hi guys! > > I'm writing an admin webinterface for a web store at the moment, > the "put-new-product" part. > > SITUATION: I have some product attributes like "Information Blocks" and > "Product Details", which are 0..n, so I'm able to delete these, or > create new. > > PROBLEM: The problem is, every time I delete or create a new detail I > have to call something an action. When I redirect back to the refreshed > form, all the stuff admin typed in before is away :( > > > QUESTION: how can I autosubmit the whole form, every time bevore > the STORE-DETAIL, DELETE-DETAIL action is called? I tried a JavaScript > Sumbit on Click, but it doesn't seem to work... My temporary solution > is a warning near every critical button, but it sux :(
Do you use a link for delete event? If yes, this might be a problem. Link does not submit a form, therefore when the form is reloaded after redirect, its content is gone. Use a button for deletion. Stick this button in the same HTML form that contains typed data that you want to save. When button is activated, its respective event handler is triggered, which is what you need. But at the same time the HTML form is submitted to the server. Struts wil try to populate the corresponding ActionForm with request values. Therefore, your action that handles delete event must work with the form that receives admin data. This ActionForm must have session scope to retain data between requests. Of course you can also use Javascript to submit form from the link, but you said you don't like using Javascript. Another thing, if you do not like how pushbutton looks, you can make it look like a link with a little CSS. Michael. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]