473,387 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

on submit, select all

Ike
I have a form I am Posting. On that form, I have a selection list,
selectedList....wherein I want to make all the items that are within that
lest be selected, automatically, when the submit button is hit.

Is there a way to do this? Thanks, Ike
Jul 20 '05 #1
7 3830
In article <kk*******************@newsread3.news.atl.earthlin k.net>,
rx*@hotmail.com enlightened us with...
I have a form I am Posting. On that form, I have a selection list,
selectedList....wherein I want to make all the items that are within that
lest be selected, automatically, when the submit button is hit.

Is there a way to do this? Thanks, Ike


Um, why?
Rather defeats the purpose.

Can you do it? Yeah. Should you? Probably not. You probably want another
type of control.

--
--
~kaeli~
Condoms should be used on every conceivable occasion.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #2
Lee
Ike said:

I have a form I am Posting. On that form, I have a selection list,
selectedList....wherein I want to make all the items that are within that
lest be selected, automatically, when the submit button is hit.

Is there a way to do this? Thanks, Ike


Yes, provided that you also allow the user to select as many
items as they like, but it's a bad idea. It means that your
server-side code won't receive data that it needs if the user
has disabled JavaScript.

List all of the available options in a hidden form field or
hard-code them into the server-side script, or write them down
and tape the list to your monitor, depending on how you're
processing the form data.

Jul 20 '05 #3
Ike
Its a drag and drop control. Elements are dragged into or out of it. I want
to select it all before submit is hit.

Thanks for the advice on condoms too, I never thought of that. Ike

"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP***********************@nntp.lucent.com...
In article <kk*******************@newsread3.news.atl.earthlin k.net>,
rx*@hotmail.com enlightened us with...
I have a form I am Posting. On that form, I have a selection list,
selectedList....wherein I want to make all the items that are within that lest be selected, automatically, when the submit button is hit.

Is there a way to do this? Thanks, Ike


Um, why?
Rather defeats the purpose.

Can you do it? Yeah. Should you? Probably not. You probably want another
type of control.

--
--
~kaeli~
Condoms should be used on every conceivable occasion.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #4
"Ike" <rx*@hotmail.com> wrote in message
news:kk*******************@newsread3.news.atl.eart hlink.net...
I have a form I am Posting. On that form, I have a selection list,
selectedList....wherein I want to make all the items that are within that
lest be selected, automatically, when the submit button is hit.

Is there a way to do this? Thanks, Ike

Perhaps this?
<html>
<head>
<title>selected.htm</title>
<script language="javascript" type="text/javascript">
<!--
function selectList() {
var form = document.forms[0];
for (var i=0; i<form.selectedList.length; i++) {
form.selectedList.options[i].selected = true;
}
return false;
}
// -->
</script>
</head>
<body>
<form method="post" onsubmit="return selectList()">
<b>Numbers:</b>
<br>
<select name="selectedList" multiple size="4">
<option value="1">One
<option value="2">Two
<option value="3">Three
<option value="4">Four
</select>
<br><input type="submit" value="Submit">
<br><input type="reset" value="Clear">
</form>
</body>
</html>
1) Change "return false;" to "return true;" after testing.
2) Change or remove: size="4"
Jul 20 '05 #5
In article <H1******************@newsread3.news.atl.earthlink .net>,
rx*@hotmail.com enlightened us with...
Its a drag and drop control. Elements are dragged into or out of it. I want
to select it all before submit is hit.


Well, assuming the user has javascript enabled, which I assume they must
for the drag and drop to work, you can just make it a mutli-select and
then iterate through the options and set selected to true for each one.
You cannot do this before submit is hit - you do it in the onClick of
the submit button, before the event is propagated to the onSubmit
handler.

See McKirahan's reply.

--
--
~kaeli~
The more ridiculous a belief system, the higher probability
of its success.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #6

"Ike" <rx*@hotmail.com> schreef in bericht
news:kk*******************@newsread3.news.atl.eart hlink.net...
I have a form I am Posting. On that form, I have a selection list,
selectedList....wherein I want to make all the items that are within that
lest be selected, automatically, when the submit button is hit.

Is there a way to do this? Thanks, Ike


ok..
put this in the head:

</script>
function selectAll(row)
{
for (i = 0; i<row.options.length;i++)
{
row.options[i].selected=true;
}
}
</script>

and this in the submit button

<input type=submit.....onClick="selectAll(this.form.selec tedList)">

that should do the trick (also)
Jul 20 '05 #7
Ike
Oh yes....Iwas tring to do it onsubmit=...but s/b onClick=.... ty

"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <H1******************@newsread3.news.atl.earthlink .net>,
rx*@hotmail.com enlightened us with...
Its a drag and drop control. Elements are dragged into or out of it. I want to select it all before submit is hit.


Well, assuming the user has javascript enabled, which I assume they must
for the drag and drop to work, you can just make it a mutli-select and
then iterate through the options and set selected to true for each one.
You cannot do this before submit is hit - you do it in the onClick of
the submit button, before the event is propagated to the onSubmit
handler.

See McKirahan's reply.

--
--
~kaeli~
The more ridiculous a belief system, the higher probability
of its success.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Stephen Witter | last post by:
I have two asp pages. Both have similar purposes. I am trying to get the inline frame in both pages to update (submit) when a user clicks on a drop-down box (I would prefer the change or after...
4
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field...
2
by: DB | last post by:
Hi All Having stared at this all morning and altered various things with no effect other then to exasperate the problem i'm wondering if anyone could take a look at the code below and see why on...
4
by: Ike | last post by:
Oh I must be missing somethign so simple and stupid. I need to do a submit() via an href, which I do (succesfully) in JavaScript in many other pages with <a...
7
by: Bosconian | last post by:
I have a simple search form inside a table with 2 selects and text and submit inputs. When entering a string into the text input and hitting return (without tabbing to and clicking "Submit") the...
2
by: somaskarthic | last post by:
Hi In my php code , i dynamically created table rows on button click event. Each row contain 3 selectboxes, 7 checkboxes . On each click of these elements i need to submit the form and save the...
2
by: sbettadpur | last post by:
Hi everybody, Hi iam strugling with more than one submit buttons with in one form here is my code <form method="post" action="Offer.php" name='issueFrm' onSubmit="return fullOfferfields();">...
15
by: colyn7 | last post by:
I really can't see what's wrong in my code... the submit() onChange doesn't work.. I've tried.. <select name="ddlTestCenter" id="ddlTestCenter" style="width:180px"...
14
by: white lightning | last post by:
How to have <select onchange="this.form.submit()"and also a Submit button on one form? I have something like this: <form action="<?php $_SERVER; ?>" method="post"...
13
Frinavale
by: Frinavale | last post by:
I've been trying all morning to cancel a form submit to the server. I have a JavaScript Object that determines whether or not the page should be submitted to the server depending on whether the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.