• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Multiple submit button form
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple submit button form


  • Subject: Re: Multiple submit button form
  • From: Mark Morris <email@hidden>
  • Date: Mon, 30 Jul 2007 16:35:56 -0500

Hi Pierre,

WebObjects knows because each submit button has a unique value that is submitted along with the rest of the form values.

I believe I remember seeing on this list mention of a Wonder component that would do what you want. (My very next project, I'm going to start using Wonder, promise!) However, if you're not using Wonder, it's not hard. Put a WOHiddenField on the form and give it a name, say MyHiddenField, and bind it to a page variable. Then have your onClick do something like:

	this.form.myHiddenField.value = "Button #1"; this.form.submit();

Have your form action bound to a method that first looks at the hidden field's page variable to decide what button has been clicked, and from there it can decide what to do.

(Warning, this was NOT cut from somewhere, so there may be typos/ logic lapses. ;-)

Hope this helps!

Regards,
Mark

On Jul 30, 2007, at 4:25 PM, Pierre Bernard wrote:

Hi!

Does anyone happen to know how WebObjects knows which button was clicked to submit a form?

I do know that the INPUT element has an elementID and how this maps to actions in invokeAction...
So it's not the WebObjects side of things I am worried about, it's the HTML.


So when a form is submitted, by default it's form action URL is called. But what parameter tells the server what triggered the submission?

OK, what I want to do is to submit a form using JavaScript. And of JavaScript I know very little. There is stuff like: document.myForm.submit()
But what if I want to simulate the click of a button? I don't think button.click() will do it as I want to attach my script to the button, so this would be an infiite loop.


Can I grab the INPUT element's ID and somehow submit it along with the form?

Pierre

- - -
Houdah Software s. à r. l.
http://www.houdah.com

HoudahGeo: One-stop photo geocoding
HoudahSpot: Powerful Spotlight frontend




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40onpointsoftware.com


This email sent to email@hidden


_______________________________________________ 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
References: 
 >Multiple submit button form (From: Pierre Bernard <email@hidden>)

  • Prev by Date: Multiple submit button form
  • Next by Date: Re: Multiple submit button form
  • Previous by thread: Multiple submit button form
  • Next by thread: Re: Multiple submit button form
  • Index(es):
    • Date
    • Thread