By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,657 Members | 1,094 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,657 IT Pros & Developers. It's quick & easy.

One form and two very different submits?

P: n/a
I seriously doubt this is possible...but you never know, so here goes.

Due to bad pre-planning I have a Web page that is VERY table heavy with
a very complicated and delicate setup. Any changes to the table
structure, as in size changes or additions of new cells, throws the
whole thing out of whack.

(Let me pause here to say I understand quite well that tables in
general are not a good idea anymore. Didn't know that until after I
built this page, and if I had time to rebuild from scratch, I would.
So, knowing already that tables are bad, CSS are good, I'm hoping I can
get some advice on the following question having that in mind.)

I need to have two forms on the page, one for a small search field and
one for a main form submission. Unfortunately any attempt to put one
form tag around the smaller search field throws the whole table
structure out of whak, so I'm forced to put the form tag around the
whole root, main table. Which means I can't use two tables.

So, is there a way to have two submit buttons that can can be forced to
submit the form to one "action" and the other to another "action"?

At worst what I can do is have one result page that checks to see if
one field is blank and if not, redirect to another page with all the
info in GET, but I really don't like that idea.

Any suggestions?
(ASIDE from "redo the page from scratch and do it right this time." I
know I know. If all you're going to do is berate me, find someone who
doesn't already know that they've created design disaster. =) Please.)

Thanks!
Liam

Jul 23 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
<ne**@celticbear.com> wrote:
So, is there a way to have two submit buttons that can can be forced to
submit the form to one "action" and the other to another "action"?
No.
At worst what I can do is have one result page that checks to see if
one field is blank and if not, redirect to another page with all the
info in GET, but I really don't like that idea.
Nonetheless, that's the way to do it.
Any suggestions?


See http://www.htmlhelp.com/faq/html/forms.html#two-submit
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"Advice is what you ask for when you know the answer but wish you didn't."
Jul 23 '05 #2

P: n/a
ne**@celticbear.com wrote:
I need to have two forms on the page, one for a small search field and
one for a main form submission. Unfortunately any attempt to put one
form tag around the smaller search field throws the whole table
structure out of whak,


Have you tried styling the form?
form {margin: 0;}
might solve your problem but without a URL it's impossible to tell.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 23 '05 #3

P: n/a

Steve Pugh wrote:
ne**@celticbear.com wrote:
I need to have two forms on the page, one for a small search field andone for a main form submission. Unfortunately any attempt to put one
form tag around the smaller search field throws the whole table
structure out of whak,


Have you tried styling the form?
form {margin: 0;}
might solve your problem but without a URL it's impossible to tell.

Good point:
http://gto.ie-studios.net/account.php

You can see the search's text field and button top left.

Styling the form, interesting thought.
Don't think it'll work in this case, because it's not exactly the form
itself that causes the problem.
That field and button top left? It's two different table cells within a
table row that includes a larger cell more to the right. If I try to
turn that row into a separate table so that I can put it into a single
larger cell so I can include FORM tags, that's what messes up the whole
table structure.

(Man I wish I'd known tables were depricated when I started this. Well,
even using tables doing it like I did was a bad idea--I know with
better foreplanning I still could have prevented this from happening.)

Thanks for the feedback!
Liam

Jul 23 '05 #4

P: n/a
ne**@celticbear.com wrote:
Steve Pugh wrote:
ne**@celticbear.com wrote:
>I need to have two forms on the page, one for a small search fieldand >one for a main form submission. Unfortunately any attempt to put one
>form tag around the smaller search field throws the whole table
>structure out of whak,
Have you tried styling the form?
form {margin: 0;}
might solve your problem but without a URL it's impossible to tell.

Good point:
http://gto.ie-studios.net/account.php

You can see the search's text field and button top left.

Styling the form, interesting thought.
Don't think it'll work in this case, because it's not exactly the form
itself that causes the problem.
That field and button top left? It's two different table cells within a
table row that includes a larger cell more to the right. If I try to
turn that row into a separate table so that I can put it into a single
larger cell so I can include FORM tags, that's what messes up the whole
table structure.


I see. You'll need to change some of the background images as well. No
big deal so long as you have the original build files and not just the
cut graphics.

Or you could just split the existing table into two. There's a row
break immediately below the search box that extends right across the
table. Turn it into two tables there.

Preumably this problem is going to appear on other pages as well -
this is a store so there will be lots of forms.

The problem is that your design is very, very inflexible. It's no
wonder that it breaks badly in some browsers already:
http://steve.pugh.net/test/games2order.jpg
(Man I wish I'd known tables were depricated when I started this. Well,
Tables are not deprecated. Tables are perfectly fine when used for
what they were designed for. They were never a good idea for page
layout though.
even using tables doing it like I did was a bad idea--I know with
better foreplanning I still could have prevented this from happening.)


Just scrap it and start again, it will save headaches and likely money
later on to do it properly now. It's not as if the world economy will
collapse if yet another online games store doesn't go live for a few
more weeks.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 23 '05 #5

P: n/a
Steve Pugh wrote:
ne**@celticbear.com wrote:
Steve Pugh wrote:
I see. You'll need to change some of the background images as well. No big deal so long as you have the original build files and not just the cut graphics.
"Need to change them", as in, in order to make the table alterations
work?
Or for some other reason I've yet to discover?
Or you could just split the existing table into two. There's a row
break immediately below the search box that extends right across the
table. Turn it into two tables there.
I'll play around with that. Thanks. =)
Preumably this problem is going to appear on other pages as well -
this is a store so there will be lots of forms.
Very good point. Until I do have a whole new page design, I may just
remove the search field in the order finalization pages. I doubt
there's TOO much of a need to seach for an item while checking out. You
can always "continue shopping" by clicking a link that takes you to
some product pages.
The problem is that your design is very, very inflexible. It's no
wonder that it breaks badly in some browsers already:
http://steve.pugh.net/test/games2order.jpg
What browser/OS is that? It looks fine on IE, and Firefox in Windows,
but breaks up similar yet different than that in Firefox in Linux. I
was hoping it would be only that combination of browser/OS, and I could
work on that later...but it looks like there's another.
Yeah, I don't like the kind of inflexibility that occurred. This
started as using a templatemonster template that I changed in order to
create a mock-up for a look, and adding different elements for the
client took off into using the mock-up design structure and it became
too big to go back and redo in the time I have.
I'm going to need to just get this up and running ASAP, and then go
back and redo the design when I have some breathing room.
(Man I wish I'd known tables were depricated when I started this. Well,
Tables are not deprecated. Tables are perfectly fine when used for
what they were designed for. They were never a good idea for page
layout though.
Really? Before CSS really took off, I can't imagine any other way of
doing layout that allows you to place elements side-by-side or in fixed
places. When I learned HTML circa 1996, tables were the way to go and
CSS hadn't even been thought of yet. <FONT> was still prominent even.
=)
even using tables doing it like I did was a bad idea--I know with
better foreplanning I still could have prevented this from

happening.)
Just scrap it and start again, it will save headaches and likely money later on to do it properly now. It's not as if the world economy will
collapse if yet another online games store doesn't go live for a few
more weeks.

LOL tell that to my client. =)
No, I have to get this up and running ASAP. Getting it "live" is the
most important priority to the client right now, even if it's
unfinished. So once I do that, I can then go back and do some reworking
with some breathing room.

Thanks so much for your time and advice!!
Liam

Jul 23 '05 #6

P: n/a
cjm
"Darin McGrew" <mc****@stanfordalumni.org> wrote in message
news:cv**********@blue.rahul.net...
<ne**@celticbear.com> wrote:
So, is there a way to have two submit buttons that can can be forced to
submit the form to one "action" and the other to another "action"?


No.


Yes, though you need to use Javascript (and that comes with it's own
baggage):

<input type="submit" name="submit1" onclick="formname.action='page1.htm';">
<input type="submit" name="submit2" onclick="formname.action='page2.htm';">

....or something like that...

I actually run a validation script, which then redirects to an appropriate
page, but the effect is the same.

I use this technique on an intranet system, so I can be sure that Javascript
is enabled, but on the WWW you can't be so sure, so beware.
At worst what I can do is have one result page that checks to see if
one field is blank and if not, redirect to another page with all the
info in GET, but I really don't like that idea.


Nonetheless, that's the way to do it.


That's *one* way to do it.

Personally, I agree with Steve - rewrite the page and use two forms...

Just my 0.02

Chris
Jul 23 '05 #7

P: n/a
<ne**@celticbear.com> wrote:
So, is there a way to have two submit buttons that can can be forced to
submit the form to one "action" and the other to another "action"?

cjm <cj*******@removeme.yahoo.co.uk> wrote: Yes, though you need to use Javascript (and that comes with it's own
baggage):
Baggage? Such as the fact that it doesn't work when disabled/unavailable?

Non-JavaScript functionality is a priority 1 checkpoint according to the
W3C's Web Content Accessibility Guidelines:
http://www.w3.org/TR/WAI-WEBCONTENT/

See also http://www.xs4all.nl/~sbpoley/webmatters/whatnojs.html
I use this technique on an intranet system, so I can be sure that Javascript
is enabled, but on the WWW you can't be so sure, so beware.


IME, you can't be sure on an intranet either. I witnessed a couple fiascoes
at my previous job, when critical intranet sites were deployed, but only
worked in certain configurations of certain browsers. Surprise--a lot of
employees had business- and disability-related reasons for using other
browsing environments.
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"FAILURE IS NOT AN OPTION. It comes bundled with the software."
Jul 23 '05 #8

P: n/a

Darin McGrew wrote:
<ne**@celticbear.com> wrote:
So, is there a way to have two submit buttons that can can be forced to submit the form to one "action" and the other to another
"action"?

cjm <cj*******@removeme.yahoo.co.uk> wrote:
Yes, though you need to use Javascript (and that comes with it's
own baggage):


Baggage? Such as the fact that it doesn't work when

disabled/unavailable?
Non-JavaScript functionality is a priority 1 checkpoint according to the W3C's Web Content Accessibility Guidelines:
http://www.w3.org/TR/WAI-WEBCONTENT/

See also http://www.xs4all.nl/~sbpoley/webmatters/whatnojs.html
Very interesting!
Something I've feared (since I love what JavaScript allows me to do)
and hoped for (since I despise troubleshooting JavaScript.)

Here's a question: I know .Net (ASP.Net certainly, and I suppose C#.Net
is no different,) allows one to make Web applications that do
JavaScript like things: like altering the page and data in real-time
without having to reload the page.
I'm not positive how .Net does the stuff it does, but can turning
JavaScript support off on the browser affect these things?
If not, I think I may want to start learning .Net....
"FAILURE IS NOT AN OPTION. It comes bundled with the software."


ROTFLMAO!
I need to make that into a sign near my desk. =)

Jul 23 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.