473,327 Members | 2,016 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,327 software developers and data experts.

form issues

I have an issue that may or may not be appropriate here, as it has to do
with client-side code. Does MS have a better forum than this one for this?
(Microsoft forum would be best. I don't have access to Usenet here at work)

Here's the problem:

Yesterday, I posted a dilemma I am facing, and got an answer, but wasn't
able to try it till today, and it doesn't work. To review:

Select box on the left contains all employees. Select box on right is empty
when the page loads. Arrow button in the middle allows you to select an
employee from the left, and it appears in the right box when the arrow
button is clicked. You can do this more than once. This all works fine.

Of course, I want it to be able to pass the values in the right box on to
the next page when I click the submit button. However, nothing gets passed.
However, when I add a name or two to the right box, and then manually select
the name(s), it does get passed to the next page. But it isn't practical to
ask someone to essentially select the names twice.

When I posted this yesterday on the Macromedia forum, I received advice to
add this code to the submit button:

onclick="selectAllOptions(document.frm.SelectedEmp )"

(where the form name is frm, and the right box is named "SelectedEmp")

Like I said in my first paragraph, it doesn't work. I suspect that it is
related to the fact that in the form tag, I have an onSubmit item, telling
it to go through the Javascript code I have for validation.

Anyone know if this could affect this. let me know. If anyone has helpful
advice, please let me know. I can't believe no one has ever done this
before. I have seen it countless times. I think.

Jul 19 '05 #1
8 1983
The only time something won't be sent with the Submit is when you have a
blank value for the pull down.

In this case you need...
Response.Write "<option value=" & strValue & ">" & strLabel &
"</option>" & chr(13)

That is a line writter that I am using inside of an ASP script to write
the lines for the pull down menu.

If your value is empty then nothing will be sent.

hth,
Andrew

* * * Sent via DevBuilder http://www.devbuilder.org * * *
Developer Resources for High End Developers.
Jul 19 '05 #2
"middletree" wrote:

Select box on the left contains all employees. Select box on right
is empty when the page loads. Arrow button in the middle allows you
to select an employee from the left, and it appears in the right
box when the arrow button is clicked. You can do this more than
once. This all works fine.

Of course, I want it to be able to pass the values in the right box
on to the next page when I click the submit button. However, nothing
gets passed. However, when I add a name or two to the right box, and
then manually select the name(s), it does get passed to the next
page. But it isn't practical to ask someone to essentially select
the names twice.


I assume you are using a <SELECT MULTIPLE> on the right, and want to simply
grab every value. Is that correct?

If so, then you have a couple of options. The first is to intercept the form
submission and select every element programmatically. The second is to store
the list in a hidden input, updating every time a name is added/dropped.
This is probably the least troublesome way, IMO.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #3
"Andrew J Durstewitz" wrote:

The only time something won't be sent with the Submit is when
you have a blank value for the pull down.


I can think of a few others. Omit the NAME attribute on the SELECT. Set the
READONLY or DISABLED attributes. Place the object outside the form. Use
<SELECT MULTIPLE> and nothing is selected by the user...
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #4
I did the following and it seems to work....I'm sure there are better
ways...but...
<%@ Language=VBScript %>
<% OPTION EXPLICIT %>

<HTML>
<HEAD>
<SCRIPT Language=Javascript>
function Move()
{

theForm.theRight.options[theForm.theRight.length]=new
Option(theForm.theLeft.options.value);
theForm.SelectedEmployees.value=theForm.SelectedEm ployees.value + ", " +
theForm.theLeft.options.value;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name=theForm id=theForm method=post action=test.asp>
<input type=hidden name=SelectedEmployees value="">
<%
Dim field
for each field in Request.Form
Response.Write "<LI>" & field & ": " & Request.Form(field) & "</LI>"
next
%>

<table>
<tr>
<td valign=top>
<SELECT name=theLeft size=10 >
<OPTION value="JOJO">JoJo</OPTION>
<option value="BOB">BOB</option>
<option value="Fred">Fred</option>
</SELECT>
</td>
<td valign=top>
<input type=button value=">>" onClick="Move();">
</td>
<td valign=top>
<SELECT name=theRight size=10 multiple>
</SELECT>
</td>
</tr>
</table>
<input type=submit value="Submit Query">
</FORM>

</BODY>
</HTML>

"middletree" <mi********@htomail.com> wrote in message
news:Ob**************@TK2MSFTNGP09.phx.gbl...
I have an issue that may or may not be appropriate here, as it has to do
with client-side code. Does MS have a better forum than this one for this?
(Microsoft forum would be best. I don't have access to Usenet here at work)
Here's the problem:

Yesterday, I posted a dilemma I am facing, and got an answer, but wasn't
able to try it till today, and it doesn't work. To review:

Select box on the left contains all employees. Select box on right is empty when the page loads. Arrow button in the middle allows you to select an
employee from the left, and it appears in the right box when the arrow
button is clicked. You can do this more than once. This all works fine.

Of course, I want it to be able to pass the values in the right box on to
the next page when I click the submit button. However, nothing gets passed. However, when I add a name or two to the right box, and then manually select the name(s), it does get passed to the next page. But it isn't practical to ask someone to essentially select the names twice.

When I posted this yesterday on the Macromedia forum, I received advice to
add this code to the submit button:

onclick="selectAllOptions(document.frm.SelectedEmp )"

(where the form name is frm, and the right box is named "SelectedEmp")

Like I said in my first paragraph, it doesn't work. I suspect that it is
related to the fact that in the form tag, I have an onSubmit item, telling
it to go through the Javascript code I have for validation.

Anyone know if this could affect this. let me know. If anyone has helpful
advice, please let me know. I can't believe no one has ever done this
before. I have seen it countless times. I think.

Jul 19 '05 #5
"middletree" wrote:

The first is to intercept the form submission and
select every element programmatically.

I have no idea how to do this. Got any sample code?


There are two schools of thought on intercepting the form submission. The
first is to depend on scripting to submit the form:

<FORM ONSUBMIT="return false" ...>
<BUTTON ONCLICK="doStuff()" ...>...</BUTTON>
...
function doStuff() {
...
document.myform.submit()
}

The second is to use a validation/maintenance script:

<FORM ONSUBMIT="return validate(this)" ...>
...
function validate(f) {
if (some conditions are met) return true
else return false
}

There's nothing stopping you from adding an extra step to the
validation/maintenance script:

...
var obj = document.myform.mySelectMultiple
for (var i=0; i<obj.length; i++) obj[i].selected = true
...
The second is to store the list in a hidden input, updating
every time a name is added/dropped. This is probably the least
troublesome way, IMO.


Not sure how to update it when names are added or dropped.


In the event handler that adds an element, add another step. Do the same for
the [drop name] handler. Example:

<INPUT TYPE="hidden" NAME="myRealList">
<SELECT MULTIPLE NAME="myDisplayList"></SELECT>
<INPUT TYPE="button" VALUE="Add Name" ONCLICK="Add()">
<INPUT TYPE="button" VALUE="Remove Name" ONCLICK="Remove()">
...
function updateRealList() {
var a = [], obj = document.myform.myDisplayList
for (var i=0; i<obj.length; i++) a.push(obj[i].value)
document.myform.myRealList.value = a.join()
}
function Add() {
... // this code remains the same as before
updateRealList() // this is all you add
}
function Remove() {
... // this code remains the same as before
updateRealList() // this is all you add
}

Untested, so there may be typos.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #6

"Dave Anderson" <GT**********@spammotel.com> wrote in message
...
var obj = document.myform.mySelectMultiple
for (var i=0; i<obj.length; i++) obj[i].selected = true
...

I think the key is in this line here. I have somethign similar, yet it is
not selecting the options like it should.
Jul 19 '05 #7
Well, thanks for your help. I got it.

What I did was I took this line out of a function and put it into my
validation script, right above the "return true;"

frm.SelectedEmp.options[intIndex].selected = true
Thanks very much for your help on this.

James W
Jul 19 '05 #8
"middletree" wrote:
for (var i=0; i<obj.length; i++) obj[i].selected = true


I think the key is in this line here. I have somethign similar,
yet it is not selecting the options like it should.


What do you have?
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #9

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

Similar topics

2
by: Mike Baugh | last post by:
I am using visual studio 2005 to develop a form using c# I have 3 datagrids on one form. I can set the row color based on a certain value in a column. However this color applies to all 3...
8
by: Ryan | last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip, data binding elements (dataset, binding source, table adapter), tab control with 7 tab pages, each page contains a...
13
by: cj | last post by:
In a project done in 2003 about a year ago I was told to add the SocketWrench code below into the Windows Form Designer generated code area as shown below. #Region " Windows Form Designer...
1
by: =?Utf-8?B?TGkgV2VuZw==?= | last post by:
Hi, I have a window application in VS2005. I can build and run it. But when I open a specific form with design view, the Visual Studio crashes and closes without error message! the error message...
22
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
9
by: RvGrah | last post by:
I'm completely new to using background threading, though I have downloaded and run through several samples and understood how they worked. My question is: I have an app whose primary form...
3
by: Doc John | last post by:
I have a windows Form that inherits from Base_form. In Base_form I added a panel that covers the whole Form (panel1.Dock = Fill). The problem is that all the controls in the Form that inherit...
2
by: Robertjb1 | last post by:
First Post - New member - I've searched the discussions available to no avail. I have, however, learned a few things in doing so. (Great Site -- Thanks) My issue is as follows: Access 2003/WinXP...
6
by: Aussie Rules | last post by:
Hi, I have an asp.net 2.0 page that has two sections. Each section allows the user to enter a value into a text box, click a button and then perform some function. Each text boxes function is...
6
by: Steve | last post by:
Hi All I have an on-screen keyboard within a POS program I have written in VB.net 2005, for touch screen computers I have it set to 'always on top' so the user can move the cursor to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.