On 5/6/07, zuban <[EMAIL PROTECTED]> wrote:
Laurie Harper wrote: > > zuban wrote: >> It is working if I type manualy ExampleSubmit.do?method=delete >> (The delete-method in the action-class ist calling) >> >> It is also working with this submit-button: >> <html:submit property="method" value="delete"/> >> >> But why doesn't work <html:submit >> onclick="this.form.method.value='delete'"> >> </html:submit> ? >> >> This should be the same like in this example: >> http://struts.apache.org/1.x/struts-extras/dispatchValidator.html > > I don't see anything like your code on that page. Setting the form's > method is not the same as passing a 'method' request parameter. What > you're doing is telling the browser to make an HTTP DELETE request > instead of a GET or POST. What are you trying to achieve by using the > onclick handler? > I'd like to have a request-parameter named "method" and the value of "method" should be set in dependence of the submit-button (if more then one submit-buttons). In other words the onclick-handler should set the request-paremter "method" to a special value. i.e. if I click on a "add-button" "method" will have the value "add" and if
Simple ways don't work for you, eh? Why would not you just use plain old <input type="submit" name="method" value="delete" /> Do you need to have different events for one button depending on some other condition? if not, then the only other reason would be that you want to have a fancier button caption instead of "delete". In this case forget about DispatchAction. Better choices like EventDispatchAction or EventActionDispatcher are available: http://wiki.apache.org/struts/EventActionDispatcher Michael. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]