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

How to pass all value of select list to backend

47 views
Skip to first unread message

Pervez Mulla

unread,
Oct 3, 2012, 7:59:29 AM10/3/12
to
In my code I want to pass all the items(values)present in select list to backend, Am trying to do that but am not getting exact result .

Now am able to pass only one item(value) to back-end, Instead of that I want to pass all the value whichever present in select list.

Below is my code

http://stackoverflow.com/q/12706942/1468281

Thank you
Pervez

dann...@gmail.com

unread,
Oct 3, 2012, 2:56:02 PM10/3/12
to
Not sure anyone understood your plight, as your wording is rather elusive.
What are you specifically trying to do again? What's the "backend" you're referring to? I saw the code it has nothing resembling items(values) on the markup or the js. If you meant to ask how to get the selected options of a 'multiple' Select element, check my previous reply to you, you iterate for all .selected ones.

Danny

Pervez Mulla

unread,
Oct 4, 2012, 1:57:20 AM10/4/12
to
Hey Danny,

Actually I want to submit all the items of select list.

Now am able to submit only one value whichever selected in select list,

I want to submit all the item(value) whichever present in the that list box currently , whether the user is selected or not those values.

Hope u got his time.

Thank you
Pervez

Evertjan.

unread,
Oct 4, 2012, 4:03:52 AM10/4/12
to
Pervez Mulla wrote on 04 okt 2012 in comp.lang.javascript:

> Actually I want to submit all the items of select list.
>
> Now am able to submit only one value whichever selected in select
> list,
>
> I want to submit all the item(value) whichever present in the that
> list box currently , whether the user is selected or not those values.

What nonsense,
a select list is for submitting the one or multiple selected items.

If you want to submit all items select them all.

Wether you do that with javascript or not is immaterial,
until you specify so.

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

Bart Van der Donck

unread,
Oct 4, 2012, 10:36:10 AM10/4/12
to
Pervez Mulla wrote:

> In my code I want to pass all the items(values)present
> in select list to backend, Am trying to do that but am
> not getting exact result.
>
> Now am able to pass only one item(value) to back-end,
> Instead of that I want to pass all the value whichever
> present in select list.

Non-selected values can't be retrieved by the receiving script, because they are simply not passed in the POST/GET request.

One possible workaround is to select everything in the box just before the submit-action:

<form method="get" action="script.php" name="f"
onSubmit="
for (var i=0; i<document.f.fruit.options.length; ++i)
document.f.fruit.options[i].selected = true;
">
<select multiple="multiple" name="fruit" size="3">
<option value="apple">apple</option>
<option value="pear">pear</option>
<option value="orange">orange</option>
</select>
<input type="submit">
</form>

Hope this helps,

--
Bart

Danny

unread,
Oct 4, 2012, 2:45:10 PM10/4/12
to
hmmmm, did you ever bothered reading my reply to your previous issue on Deletion of options? it seems you didn't, as it shows how to get all .selected options. Anyhow, this was my example, check the code-> http://www.webdevout.net/test?01b&raw

Evertjan.

unread,
Oct 4, 2012, 3:57:28 PM10/4/12
to
Danny wrote on 04 okt 2012 in comp.lang.javascript:

> hmmmm, did you ever bothered reading my reply to your previous issue
> on Deletion of options?

Who is this "you"?

Usenet is not email.

Always quote for reference on usenet.

Anyway: I did not ever bothered!

dann...@gmail.com

unread,
Oct 4, 2012, 4:49:46 PM10/4/12
to
har har har, alright, my bad, you == Pervez Mulla, :)
0 new messages