Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

element not showing in Request.Form

0 views
Skip to first unread message

pbd22

unread,
Mar 8, 2008, 2:20:05 PM3/8/08
to

Is there any reason why the below function wouldn't
allow the server to "Request.Form("visitors")?

The form just starts with this:

<select class="select_medium" name="visitors" id="visitors" size="7"></
select>

And the testAdd() function adds email addresses to the select.

Then i submit the form but the "visitors" element is never one of the
keys
(yes, it is inside the form tag).

Any ideas???

Thanks

function testAdd() {


try
{

var inputvalue = document.getElementById('visitor').value;
var formObject = document.getElementById('visitors');
var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+
([a-zA-Z])+/;
var goodemail;
var err = "";

if(pattern.test(inputvalue)){
goodemail = true;
}else{

if (inputvalue == "")
alert("You must type in an email address");
else
{
alert("Bad email address syntax.\n Check for format
errors.");
goodemail = false;
}
}

if (goodemail == true)
{
if (inputvalue.indexOf("vodafone") != -1)
{
addOption(formObject,inputvalue,inputvalue);
document.getElementById('visitor').value = "";
} else
{
alert("You can only send to other vodafone
employees");
}

}

}catch(e){alert(e.message);}


}

VK

unread,
Mar 8, 2008, 3:37:06 PM3/8/08
to
On Mar 8, 10:20 pm, pbd22 <dush...@gmail.com> wrote:
> Is there any reason why the below function wouldn't
> allow the server to "Request.Form("visitors")?
>
> The form just starts with this:
>
> <select class="select_medium" name="visitors" id="visitors" size="7"></
> select>
>
> And the testAdd() function adds email addresses to the select.
>
> Then i submit the form but the "visitors" element is never one of the
> keys
> (yes, it is inside the form tag).
>
> Any ideas???

They may appear if you post the relevant code ;-) In your case it is
addOption function, the posted e-mail testing code is not relevant.

Also what do you want to be submitted? A particular option in the list
or the last added option?

pbd22

unread,
Mar 8, 2008, 9:11:15 PM3/8/08
to
Hi.

Yes, sorry. That function would have helped:

function addOption(selectObject,optionText,optionValue) {
var optionObject = new Option(optionText,optionValue)
var optionRank = selectObject.options.length
selectObject.options[optionRank]=optionObject
}

I want to submit all options in the list. Eg.

<select class="select_medium" name="visitors" id="visitors" size="7">

<option value="pe...@google.com">pe...@google.com</option>
<option value="pa...@google.com">pa...@google.com</option>
<option value="ma...@google.com">ma...@google.com</option>
<option value="jo...@google.com">jo...@google.com</option>
</select>


Thomas 'PointedEars' Lahn

unread,
Mar 8, 2008, 9:34:09 PM3/8/08
to

Although the `id' attribute seems superfluous, your posted code does not
provide a good reason why server-side Request.Form("visitors") would be
unavailable. Make sure that your submitting markup is valid, and try again.

This is rather an ASP (.NET) problem. I suggest you ask in the appropriate
newsgroup instead.


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300...@news.demon.co.uk>

pbd22

unread,
Mar 8, 2008, 10:55:54 PM3/8/08
to
OK, thanks.

I thought there might be something in my javascript logic that was
missing the mark.
I will do as you suggest and thanks for piping in.

Best,
Pbd

VK

unread,
Mar 9, 2008, 6:21:12 AM3/9/08
to
On Mar 9, 5:11 am, pbd22 <dush...@gmail.com> wrote:
> Hi.
>
> Yes, sorry. That function would have helped:
>
> function addOption(selectObject,optionText,optionValue) {
> var optionObject = new Option(optionText,optionValue)
> var optionRank = selectObject.options.length
> selectObject.options[optionRank]=optionObject
>
> }
>
> I want to submit all options in the list. Eg.
>
> <select class="select_medium" name="visitors" id="visitors" size="7">
> <option value="pe...@google.com">pe...@google.com</option>
> <option value="p...@google.com">p...@google.com</option>
> <option value="m...@google.com">m...@google.com</option>
> <option value="j...@google.com">j...@google.com</option>
> </select>

Oh, it is easy then. You just have to recall some HTML basics (Thomas
has failed on it miserably alas):

1) On submit browser sends not each and every option value in select,
but only options _selected_ by the user.
2) In order to be able to have several - or all - options selected at
once one has to set MULTIPLE flag on.

This way the proper SELECT element declaration will be:
<select class="select_medium" name="visitors" size="7" multiple>
or if you need to accommodate it for XHTML validator then
<select class="select_medium" name="visitors" size="7"
multiple="multiple">

This way the proper Javascript code might be:

function addOption(selectObject,optionText,optionValue) {
var optionObject = new Option(optionText,optionValue);
var optionRank = selectObject.options.length;

selectObject.options[optionRank]=optionObject;
selectObject.options[optionRank].selected = true;
}

Enjoy.

Thomas 'PointedEars' Lahn

unread,
Mar 9, 2008, 7:30:02 AM3/9/08
to
VK wrote:
> On Mar 9, 5:11 am, pbd22 <dush...@gmail.com> wrote:
>> Yes, sorry. That function would have helped:
>>
>> function addOption(selectObject,optionText,optionValue) {
>> var optionObject = new Option(optionText,optionValue)
>> var optionRank = selectObject.options.length
>> selectObject.options[optionRank]=optionObject
>>
>> }
>>
>> I want to submit all options in the list. Eg.
>>
>> <select class="select_medium" name="visitors" id="visitors" size="7">
>> <option value="pe...@google.com">pe...@google.com</option>
>> <option value="p...@google.com">p...@google.com</option>
>> <option value="m...@google.com">m...@google.com</option>
>> <option value="j...@google.com">j...@google.com</option>
>> </select>
>
> Oh, it is easy then. You just have to recall some HTML basics (Thomas
> has failed on it miserably alas):
>
> 1) On submit browser sends not each and every option value in select,
> but only options _selected_ by the user.
> 2) In order to be able to have several - or all - options selected at
> once one has to set MULTIPLE flag on.
> [...]

Nothing you say has anything to do with the original problem:

| Is there any reason why the below function wouldn't
| allow the server to "Request.Form("visitors")?

It might be that the original problem was not well described, and that the
additional posting clarified it (which I would have ignored), but so far for
"failing miserably".


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

VK

unread,
Mar 9, 2008, 6:38:10 PM3/9/08
to
> > Oh, it is easy then. You just have to recall some HTML basics
> > (Thomas has failed on it miserably alas):

> Nothing you say has anything to do with the original problem:


>
> | Is there any reason why the below function wouldn't
> | allow the server to "Request.Form("visitors")?
>
> It might be that the original problem was not well described,
> and that the additional posting clarified it (which I would have
> ignored), but so far for "failing miserably".

Non sequitur ;-) In your last response you have quoted the relevant
part of OP's response you were answering to (this is the only right
quoting you are always doing, right?) and it contains exactly all you
needed to see the problem:
http://groups.google.com/group/comp.lang.javascript/msg/b6a767ef229e7585

Thomas 'PointedEars' Lahn

unread,
Mar 9, 2008, 8:45:12 PM3/9/08
to
VK wrote:
>>> Oh, it is easy then. You just have to recall some HTML basics
>>> (Thomas has failed on it miserably alas):
>
>> Nothing you say has anything to do with the original problem:
>>
>> | Is there any reason why the below function wouldn't
>> | allow the server to "Request.Form("visitors")?
>>
>> It might be that the original problem was not well described,
>> and that the additional posting clarified it (which I would have
>> ignored), but so far for "failing miserably".
>
> Non sequitur ;-)

You should not be using foreign words if you are unable to apply them
properly. "Non sequitur" means that there is a conclusion in the
aforementioned statement that would not follow from a premise; there
is no such thing there.

VK

unread,
Mar 10, 2008, 12:05:58 PM3/10/08
to
On Mar 10, 3:45 am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:

> VK wrote:
> >>> Oh, it is easy then. You just have to recall some HTML basics
> >>> (Thomas has failed on it miserably alas):
>
> >> Nothing you say has anything to do with the original problem:
>
> >> | Is there any reason why the below function wouldn't
> >> | allow the server to "Request.Form("visitors")?
>
> >> It might be that the original problem was not well described,
> >> and that the additional posting clarified it (which I would have
> >> ignored), but so far for "failing miserably".
>
> > Non sequitur ;-)
>
> You should not be using foreign words if you are unable to apply them
> properly. "Non sequitur" means that there is a conclusion in the
> aforementioned statement that would not follow from a premise; there
> is no such thing there.

1) One should always quote what he's replying to but not above it.
2) Thomas Lahn always follows this rule as many time stated by him.
3) Thomas Lahn quoted OP's code for addOption function and OP's
explanation of the desired behavior.
http://groups.google.com/group/comp.lang.javascript/msg/b6a767ef229e7585
4) In the response Thomas Lahn stated that "Although the `id'


attribute seems superfluous, your posted code does not provide a good
reason why server-side Request.Form("visitors") would be unavailable."

5) When being criticized Thomas Lahn stated that


"It might be that the original problem was not well described, and
that the additional posting clarified it (which I would have

ignored)."

Non sequitur.

P.S. If you want another shot in formal logic or semantic analysis
then just let me know ;-)

pbd22

unread,
Mar 12, 2008, 3:32:52 PM3/12/08
to
Hi.

Thanks.

The line of code you added:

selectObject.options[optionRank]=optionObject

Gives me a:
"selectObject has no properties" error.

Peter

VK

unread,
Mar 12, 2008, 3:49:20 PM3/12/08
to

That means (99% of probability) that selectObject indeed doesn't
exist. You either mistyped the name or broke the code somewhere. Post
the surrent source - an actual URL would be completely terrific.

pbd22

unread,
Mar 12, 2008, 8:49:07 PM3/12/08
to
i sent this link to your personal account.

thanks again,
peter

Evertjan.

unread,
Mar 13, 2008, 5:51:15 AM3/13/08
to
pbd22 wrote on 13 mrt 2008 in comp.lang.javascript:

> i sent this link to your personal account.

whose?

[please always quote on usenet]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

pbd22

unread,
Mar 13, 2008, 12:46:43 PM3/13/08
to
To the guy who asked me for a link :)
VK - just above my last post.

Thanks again.

Evertjan.

unread,
Mar 13, 2008, 3:16:19 PM3/13/08
to
pbd22 wrote on 13 mrt 2008 in comp.lang.javascript:

> To the guy who asked me for a link :)
> VK - just above my last post.

What is "above" on usenet?

0 new messages