472,328 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Update pulldown via disconnected rs? possible?

Is there a way - possibly a disconnected rs? - to update the contents of an
existing pulldown on a page without having to re-submit the page for the
user to see the pulldown populated with an additional value?

I realise there are javascript possibilities (and I am still searching for a
usable one) but I thought perhaps it may be possible to allow a user to add
a new entry to a drop down box that had been dynamically populated from an
access table to begin with.

Thus:

Access 2000 >> asp page >> populate dropdown box with product list

Example:

-- pulldown---
productA
productB
productC

User wants to add Product D but does not want to have to re-submit page by
filling in a text and pressing submit and then waiting for dynamic page to
reload.

He wants to enter text into text box and immediately update list. Once he
has completed filling out rest of page he will submit all form variables and
update list to database.

Is this somehow achievable via a little know asp recordset such as Marshal
Options or something like that - interested in options...

Thanks
jason
Jul 19 '05 #1
7 2204
What I've done in the past is used client side script to allow the user to
enter a new item in the dropdown box. And I'd give that item a value of -1
or something that I know won't exist already. Then, when the page is
submitted, the processing ASP code would have:

iID = Request.form("theDropdownbox")

If iID = "-1" Then
'''code to insert new value and return the ID of it
iID =
InsertNewValue(Request.Form("HIDDEN_INPUT_THAT_HAS _THE_VALUE_THE_USER_ENTERE
D"))
End If

'''continue on.

The "InsertNewValue" would be a function that inserts the new value and
returns the ID from that insert, i.e.

function InsertNewValue(TheVAlue)
InsertNewValue = TheADOConnection.EXecute("EXEC theStoredProcedure '" &
Replace(TheValue, "'", "''") & "'")(0).Value
End Function
The stored procedure would be something like:

create proc theStoredProcedure @SomeValue varchar(100) as
insert into theTable (TheColumn) values (@SomeValue)
select scope_identity()
go

I'm just kinda rambling as I type here, so I probably don't make any sense.

Ray at work

"jason" <ja***@catamaranco.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Is there a way - possibly a disconnected rs? - to update the contents of an existing pulldown on a page without having to re-submit the page for the
user to see the pulldown populated with an additional value?

I realise there are javascript possibilities (and I am still searching for a usable one) but I thought perhaps it may be possible to allow a user to add a new entry to a drop down box that had been dynamically populated from an
access table to begin with.

Thus:

Access 2000 >> asp page >> populate dropdown box with product list

Example:

-- pulldown---
productA
productB
productC

User wants to add Product D but does not want to have to re-submit page by
filling in a text and pressing submit and then waiting for dynamic page to
reload.

He wants to enter text into text box and immediately update list. Once he
has completed filling out rest of page he will submit all form variables and update list to database.

Is this somehow achievable via a little know asp recordset such as Marshal
Options or something like that - interested in options...

Thanks
jason

Jul 19 '05 #2
Hey Ray - I know you typed that up quickly, but that is almost exactly what
I am looking for....

I will start testing this and come back with more questions but just
quickly:

1. What if the user decides to add more than one option to the pulldown on
the preceding page....will this be problematic on the asp processing page as
one would then have to go into a check # of ids and loop situation to insert
the multiple new items into the Access table?

2. I have found 'almost' sites which show how to populate a drop down with
the content value of another drop down but I have yet to find one that
allows me to enter text into a text box and then update the pull
down...could you help with this....I also posted to the js group..but still
no reply.

3. I can easily create a stored query in access (you actually helped in this
area a while back) but I just wanted to check if your sql server sp had any
special inflections that I should reproduce in the access query...

Many thanks
Jason

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:OL**************@TK2MSFTNGP09.phx.gbl...
What I've done in the past is used client side script to allow the user to
enter a new item in the dropdown box. And I'd give that item a value of -1 or something that I know won't exist already. Then, when the page is
submitted, the processing ASP code would have:

iID = Request.form("theDropdownbox")

If iID = "-1" Then
'''code to insert new value and return the ID of it
iID =
InsertNewValue(Request.Form("HIDDEN_INPUT_THAT_HAS _THE_VALUE_THE_USER_ENTERE D"))
End If

'''continue on.

The "InsertNewValue" would be a function that inserts the new value and
returns the ID from that insert, i.e.

function InsertNewValue(TheVAlue)
InsertNewValue = TheADOConnection.EXecute("EXEC theStoredProcedure '" & Replace(TheValue, "'", "''") & "'")(0).Value
End Function
The stored procedure would be something like:

create proc theStoredProcedure @SomeValue varchar(100) as
insert into theTable (TheColumn) values (@SomeValue)
select scope_identity()
go

I'm just kinda rambling as I type here, so I probably don't make any sense.
Ray at work

"jason" <ja***@catamaranco.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Is there a way - possibly a disconnected rs? - to update the contents of an
existing pulldown on a page without having to re-submit the page for the
user to see the pulldown populated with an additional value?

I realise there are javascript possibilities (and I am still searching for a
usable one) but I thought perhaps it may be possible to allow a user to

add
a new entry to a drop down box that had been dynamically populated from

an access table to begin with.

Thus:

Access 2000 >> asp page >> populate dropdown box with product list

Example:

-- pulldown---
productA
productB
productC

User wants to add Product D but does not want to have to re-submit page by filling in a text and pressing submit and then waiting for dynamic page to reload.

He wants to enter text into text box and immediately update list. Once he has completed filling out rest of page he will submit all form variables

and
update list to database.

Is this somehow achievable via a little know asp recordset such as Marshal Options or something like that - interested in options...

Thanks
jason


Jul 19 '05 #3

"jason" <ja***@catamaranco.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hey Ray - I know you typed that up quickly, but that is almost exactly what I am looking for....

I will start testing this and come back with more questions but just
quickly:

1. What if the user decides to add more than one option to the pulldown on
the preceding page....will this be problematic on the asp processing page as one would then have to go into a check # of ids and loop situation to insert the multiple new items into the Access table?

I guess the options there are either "TFB" for the user, and only the last
value he enters will get added, or you'll have to adjust your client side
code to allow for it. On the pages where I've done this, it would be odd
for the user to enter several new values to the drop-down, but that's just
my excuse for not having to code too much. :]


2. I have found 'almost' sites which show how to populate a drop down with
the content value of another drop down but I have yet to find one that
allows me to enter text into a text box and then update the pull
down...could you help with this....I also posted to the js group..but still no reply.
I'M NO JAVASCRIPT EXPERT!
<form name="theForm">
<select name="theSelect">
<option value="1">One</option>
<option value="2">Two</option>
</select>
<input type="text" name="newValue">
<input type="button" value="Add that" onclick="addValue();">
</form>
<script language="javascript">
function addValue()
{
var sVal = document.theForm.newValue.value;
if(sVal.length>0)
{
var o=document.theForm.theSelect
o.options[o.length] = new Option(sVal, '-1', true)
o.options[o.length-1].selected=true;
}
}
</script>

3. I can easily create a stored query in access (you actually helped in this area a while back) but I just wanted to check if your sql server sp had any special inflections that I should reproduce in the access query...


I don't really know about stored queries in Access, but the one thing is
that you'll have to go about getting the ID number (if you need it) in a
different way. Like here. http://www.aspfaq.com/show.asp?id=2174

Ray at work


Jul 19 '05 #4
The js works as suggested....although I am not sure what "TFB" means. I
guess I could restrict the user to inserting only one entry per page. I
suspect the my users would start nagging me to allow multiple entry points
on this page rather than an in another administrative area dedicated to this
specific task.
I will start woking on the sp and processing page....thanks...
- Jason
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:#$**************@TK2MSFTNGP09.phx.gbl...

"jason" <ja***@catamaranco.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hey Ray - I know you typed that up quickly, but that is almost exactly what
I am looking for....

I will start testing this and come back with more questions but just
quickly:

1. What if the user decides to add more than one option to the pulldown on the preceding page....will this be problematic on the asp processing page as
one would then have to go into a check # of ids and loop situation to

insert
the multiple new items into the Access table?

I guess the options there are either "TFB" for the user, and only the last
value he enters will get added, or you'll have to adjust your client side
code to allow for it. On the pages where I've done this, it would be odd
for the user to enter several new values to the drop-down, but that's just
my excuse for not having to code too much. :]


2. I have found 'almost' sites which show how to populate a drop down

with the content value of another drop down but I have yet to find one that
allows me to enter text into a text box and then update the pull
down...could you help with this....I also posted to the js group..but

still
no reply.


I'M NO JAVASCRIPT EXPERT!
<form name="theForm">
<select name="theSelect">
<option value="1">One</option>
<option value="2">Two</option>
</select>
<input type="text" name="newValue">
<input type="button" value="Add that" onclick="addValue();">
</form>
<script language="javascript">
function addValue()
{
var sVal = document.theForm.newValue.value;
if(sVal.length>0)
{
var o=document.theForm.theSelect
o.options[o.length] = new Option(sVal, '-1', true)
o.options[o.length-1].selected=true;
}
}
</script>

3. I can easily create a stored query in access (you actually helped in

this
area a while back) but I just wanted to check if your sql server sp had

any
special inflections that I should reproduce in the access query...


I don't really know about stored queries in Access, but the one thing is
that you'll have to go about getting the ID number (if you need it) in a
different way. Like here. http://www.aspfaq.com/show.asp?id=2174

Ray at work

Jul 19 '05 #5
"jason" <ja***@catamaranco.com> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl...
The js works as suggested....although I am not sure what "TFB" means. I guess I could restrict the user to inserting only one entry per page. I suspect the my users would start nagging me to allow multiple entry points on this page rather than an in another administrative area dedicated to this specific task.
I will start woking on the sp and processing page....thanks...


TFB = Too F#$%^&*! Bad

As for multiple entries, how about tweaking Ray's solution by assigning
decreasing negative numbers to new entries. Then on the server side
batch insert only the negative number entries. This is the technique I
use for a PDA (Personal Digital Assistant) application where multiple
entries were required.

HTH (Hope that helps)
-CH (Chris Hohmann)
Jul 19 '05 #6
Hey Chris

Your idea:

assigning
decreasing negative numbers to new entries.
....sounds good but how would one do this in javascript. At the moment
ray's code does is insert "-1" as the value. I would now have to check for
the counter of the preceeding value before adding it and then adding 1.
Could you possibly help with this?

Also, I had the idea of mabye turning off the submit button to DISABLED once
the user had inputted one new value, but this is also a bit of mystery to
me. The .js group is not as vibrant as the .asp forum unfortunately....I'll
keep trying some google searches around disabling command buttons.

- Jason
"Chris Hohmann" <no****@thankyou.com> wrote in message
news:ur**************@tk2msftngp13.phx.gbl... "jason" <ja***@catamaranco.com> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl...
The js works as suggested....although I am not sure what "TFB" means.

I
guess I could restrict the user to inserting only one entry per page.

I
suspect the my users would start nagging me to allow multiple entry

points
on this page rather than an in another administrative area dedicated

to this
specific task.
I will start woking on the sp and processing page....thanks...


TFB = Too F#$%^&*! Bad

As for multiple entries, how about tweaking Ray's solution by assigning
decreasing negative numbers to new entries. Then on the server side
batch insert only the negative number entries. This is the technique I
use for a PDA (Personal Digital Assistant) application where multiple
entries were required.

HTH (Hope that helps)
-CH (Chris Hohmann)

Jul 19 '05 #7
"jason" <ja***@catamaranco.com> wrote in message
news:OD**************@tk2msftngp13.phx.gbl...
Hey Chris

Your idea:

assigning
decreasing negative numbers to new entries.
...sounds good but how would one do this in javascript. At the

moment ray's code does is insert "-1" as the value. I would now have to check for the counter of the preceeding value before adding it and then adding 1. Could you possibly help with this?

Also, I had the idea of mabye turning off the submit button to DISABLED once the user had inputted one new value, but this is also a bit of mystery to me. The .js group is not as vibrant as the .asp forum unfortunately....I'll keep trying some google searches around disabling command buttons.

- Jason


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Select Population - Proof of Concept</title>
<script language="JavaScript">
//I'M NO JAVASCRIPT EXPERT EITHER!
function addValue(){
var frm = document.theForm;
var sVal = frm.newValue.value;
if(sVal.length){
var opts = frm.theSelect.options;
var iNext = opts[opts.length-1].value - 1;
opts[opts.length] = new Option(sVal, iNext<0?iNext:-1, true);
opts[opts.length-1].selected=true;
if(!frm.pbSubmit.disabled)frm.pbSubmit.disabled=tr ue;
}
}
</script>
</head>
<body>
<form name="theForm">
<select name="theSelect">
<option value="1">One</option>
<option value="2">Two</option>
</select>
<input name="newValue" type="text">
<input type="button" value="Add that" onclick="addValue();">
<input name="pbSubmit" type="Submit" value="submit">
</form>
</body>
</html>

HTH
-Chris Hohmann
Jul 19 '05 #8

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

Similar topics

3
by: R.G. Vervoort | last post by:
I would like to select an option in a pulldown, select a record in a mysql database depending on the pulldown selection and then put the data from...
3
by: Mark R | last post by:
I have one .asp page with a SELECT pulldown list on it and some INPUT fields. When SUBMIT is clicked the form data is submitted to that same page...
1
by: cgplays.com | last post by:
I have a select-pulldown at http://computergroupplays.com/fb-pres2.asp that changes the 3rd pulldown (Dbase) depending on what the user enters in...
2
by: Simon Wigzell | last post by:
Is it possible within javascript to stop the little pulldown menu (with the values that the browser remembers have previously been entered into the...
6
by: pg | last post by:
Is there any simple way to query the most recent time of "changes" made to a table? I'm accessing my database with ODBC to a remote site thru...
4
by: Richard MSL | last post by:
I am making a combobox, where I add items to the combobox as they are required, as the user scrolls to the top or bottom of the list of items. It...
4
by: Lada 'Ray' Lostak | last post by:
Hello there, I am thinking how to solve another typical problem of online systems with combination of thin client... Imagine simple case, 2 users...
10
by: Roger Withnell | last post by:
I'm using ASP, VBScript and SQL Server. I'm also using UTF-8 character set and so my codepage is 65001 and SQL Server datatype nvarchar. I can...
30
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data,...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.