AW: [Javascript] Re: one form, two submit ways

Michael Borchers borchers at tridem.de
Thu Feb 17 06:12:13 CST 2005


> On Thu, Feb 17, 2005 at 12:32:31PM +0100, Michael Borchers wrote:
> > <form action="script.php" name="form>
> > ...
> > some inputs
> > ...
> > 
> > <select name="subaction">
> > option book
> > option print
> > 
> > submit ???
> > 
> > </form>
> > 
> > 
> > the subaction later decides what to do with the data.
> > 
> > now i would like to leave out the select for subaction
> > and offer two submit buttons with "book" and "print"
> > but with the same effect.
> 
> Assuming that subaction is processed on the server, I'd presume that
> 
> <input type="submit" name="subaction" value="book">
> <input type="submit" name="subaction" value="print">
> 
> Would do the job.  If subaction is processed in an onChange 
> or onSubmit
> handler, then you can just keep the same basic code and just 
> add onClick
> handlers to your two submit buttons.
> 
> - Matt


this works perfectely.
the only "prob" i have is my php script now.
f.e. when it asks for subaction's value it has to be "book" or "print",
the words that appear on the buttons.
but in a different language like german "buchen", "drucken"
it would no longer work.

for that cas i could use an image of course
or produce it dynamically with php.

but anyway: is there a possibility to split
the value of the button
and the value written on the button?



More information about the Javascript mailing list