<form name = 'form1' .... >
<input name= 'field1' ... >
</form>
<form name = 'form2' .... >
<input name= 'field1' ... >
</form>
--
Ed Jay (remove 'M' to reply by email)
Win the War Against Breast Cancer.
Knowing the facts could save your life.
http://www.breastthermography.info
Yes.
Thanks.
> Harlan Messinger wrote:
>
> >Ed Jay wrote:
> >> Is it allowable to use the same name for multiple input elements if
> >> they're in different forms? Example:
> >>
> >> <form name = 'form1' .... >
> >> <input name= 'field1' ... >
> >> </form>
> >>
> >> <form name = 'form2' .... >
> >> <input name= 'field1' ... >
> >> </form>
> >>
> >
> >Yes.
>
> Thanks.
Just a minute! Is this thread some sort of joke? A bloke asks a clear
question, another answers simply, the first thanks him and that's it? No
complications, no misunderstandings, no personal animosity, no
irrelevant posts thrown into the mix?
I don't like it! It is too good, there must be something wrong. Whenever
my old Ford ran too well, it was a bad sign.
--
dorayme
Maybe.
> No complications, no misunderstandings, no personal animosity, no
> irrelevant posts thrown into the mix?
You just proved that to be wrong.
(And we don't know what the real problem was, as usual.)
--
Yucca, http://www.cs.tut.fi/~jkorpela/
> Is it allowable to use the same name for multiple input elements if
> they're in different forms?
Probably. Possibly. But since they are in different forms, why do you
want to muddy the waters over in your (unnamed) action script?
$field1 = $_POST['field1'];
Umm, which one? Think about maintenance in six months...
--
-bts
-tossing 2� more, 'cause I can
> In article <vsqhj5hvks0oogqvr...@4ax.com>,
> Ed Jay <ed...@aes-intl.com> wrote:
>
>> Harlan Messinger wrote:
>>
>> >Ed Jay wrote:
>> >> Is it allowable to use the same name for multiple input elements if
>> >> they're in different forms? Example:
>> >
>> >Yes.
>>
>> Thanks.
>
> Just a minute! Is this thread some sort of joke? A bloke asks a clear
> question, another answers simply, the first thanks him and that's it?
Yeah, well, it's the holidays. ;-)
sherm--
> dorayme wrote:
>
> > Just a minute! Is this thread some sort of joke?
>
> Maybe.
>
> > No complications, no misunderstandings, no personal animosity, no
> > irrelevant posts thrown into the mix?
>
> You just proved that to be wrong.
>
> (And we don't know what the real problem was, as usual.)
I started to have misgivings about my light-hearedness the moment I
pressed the send button. <g>
--
dorayme
> a.non...@example.invalid wrote:
>> Ed Jay wrote:
>>> Is it allowable to use the same name for multiple input elements if
>>> they're in different forms?
>>
>> Probably. Possibly. But since they are in different forms, why do
>> you want to muddy the waters over in your (unnamed) action script?
>>
>> $field1 = $_POST['field1'];
>>
>> Umm, which one? Think about maintenance in six months...
>>
> Since they are in different forms, there's no reason to suppose that
> the same script processes each form.
..further muddying the waters.
--
-bts
-Four wheels carry the body; two wheels move the soul
If the forms are submitted to different URLs, it doesn't matter. If they
are submitted to the same URL, then either the forms are meant to serve
as alternate interfaces to the same handler, in which case they are
*supposed* to be indistinguishable, or they aren't, in which case it's
hard to imagine that the developer hasn't figured out that they two
forms need to be routed somehow to two different handlers.
I'll answer everyone's response with this...
I have two forms contained on the same page. A credit memo form and a
debit memo form. The visible form depends on the user's menu choice. Each
form contains a single checkbox element, which when checked, is the flag
to send the memo to the recipient of the credit or debit when whichever
form is submitted.
I thought of the complexity of sorting things out at my Perl script end,
and decided it would be much easier if I could simply use two input
elements with the same name in each of the two forms. All my script does
is if the box is checked, do a routine. No chance for conflicts, but I
appreciate the concern for potential problems. That's why, when I was
unsure, I thought of asking.
So, I asked my question, with enough information given to solicit a simple
yes/no answer. Harlan's answer was spot on, and appropriately commented on
by dorayme.
Thanks to all.
> I'll answer everyone's response with this...
As usual, the situation would have been much clearer if you had posted the
URL, and the URL would still be useful.
> I have two forms contained on the same page. A credit memo form and a
> debit memo form.
That's possible, but why not put them on separate pages? What are the odds
that both of them are needed at the same time?
> The visible form depends on the user's menu choice.
Do you mean that you rely on CSS _and_ scripting to make one of the forms
invisible? In effect, you have one form per page, but you do that in an
unnecessarily complicated and unreliable way.
> Each form contains a single checkbox element, which when checked, is
> the flag to send the memo to the recipient of the credit or debit
> when whichever form is submitted.
I don't quite see why you need it, but presumably sending the memo is an
optional feature in form data processing.
> I thought of the complexity of sorting things out at my Perl script
> end, and decided it would be much easier if I could simply use two
> input elements with the same name in each of the two forms.
I can't believe it can be "much easier" - you would probably need just one
conditional expression.
You _can_ use the same name="..." attribute, of course (though not the same
id="..." attribute). And there's no particular reason to use different
attributes. The same applies to the approach of using two separate pages, as
you would probably generate them by the same Perl script, just with some
parameterization.
> So, I asked my question, with enough information given to solicit a
> simple yes/no answer.
And the correct answer was given, but the question was wrong, in practical
terms. Well, rather irrelevant, let us say. The question you now implicitly
(well, very implicitly...) asked is much more important: should you have two
forms on the same page?
--
Yucca, http://www.cs.tut.fi/~jkorpela/