473,387 Members | 1,606 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.

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 2295
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 the record in the textfields. I can retrieve...
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 and validated. If INPUT fields are empty the asp...
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 the 2nd (Wk). My associate wants the values inside...
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 field) from appearing? I have one very dense form...
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 internet. I want to eliminate some DUPLICATE long...
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 is a sorted combobox. Scrolling down works fine,...
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 are going to edit 'same' datas. Both see on the...
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 insert unicode characters correctly into the...
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, from a database. One user changes the data and...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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.