473,836 Members | 1,381 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2321
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("t heDropdownbox")

If iID = "-1" Then
'''code to insert new value and return the ID of it
iID =
InsertNewValue( Request.Form("H IDDEN_INPUT_THA T_HAS_THE_VALUE _THE_USER_ENTER E
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 = TheADOConnectio n.EXecute("EXEC theStoredProced ure '" &
Replace(TheValu e, "'", "''") & "'")(0).Val ue
End Function
The stored procedure would be something like:

create proc theStoredProced ure @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***@catamara nco.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.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******** ******@TK2MSFTN GP09.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("t heDropdownbox")

If iID = "-1" Then
'''code to insert new value and return the ID of it
iID =
InsertNewValue( Request.Form("H IDDEN_INPUT_THA T_HAS_THE_VALUE _THE_USER_ENTER E 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 = TheADOConnectio n.EXecute("EXEC theStoredProced ure '" & Replace(TheValu e, "'", "''") & "'")(0).Val ue
End Function
The stored procedure would be something like:

create proc theStoredProced ure @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***@catamara nco.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.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***@catamara nco.com> wrote in message
news:%2******** ********@tk2msf tngp13.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="addVal ue();">
</form>
<script language="javas cript">
function addValue()
{
var sVal = document.theFor m.newValue.valu e;
if(sVal.length> 0)
{
var o=document.theF orm.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....al though 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:#$******** ******@TK2MSFTN GP09.phx.gbl...

"jason" <ja***@catamara nco.com> wrote in message
news:%2******** ********@tk2msf tngp13.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="addVal ue();">
</form>
<script language="javas cript">
function addValue()
{
var sVal = document.theFor m.newValue.valu e;
if(sVal.length> 0)
{
var o=document.theF orm.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***@catamara nco.com> wrote in message
news:ux******** ******@TK2MSFTN GP12.phx.gbl...
The js works as suggested....al though 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****@thankyo u.com> wrote in message
news:ur******** ******@tk2msftn gp13.phx.gbl... "jason" <ja***@catamara nco.com> wrote in message
news:ux******** ******@TK2MSFTN GP12.phx.gbl...
The js works as suggested....al though 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***@catamara nco.com> wrote in message
news:OD******** ******@tk2msftn gp13.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="JavaS cript">
//I'M NO JAVASCRIPT EXPERT EITHER!
function addValue(){
var frm = document.theFor m;
var sVal = frm.newValue.va lue;
if(sVal.length) {
var opts = frm.theSelect.o ptions;
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.pbSubmi t.disabled)frm. pbSubmit.disabl ed=true;
}
}
</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="addVal ue();">
<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
2627
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 the pulldown value using javascript I can open the database and select the record using php how can i combine the 2 to within the onchange option of the pull down.
3
4199
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 code will insert a visual indicator (e.g. *) to convey that the field must be filled in. However, if the user has made a selection in the pulldown list and has left an INPUT field empty, when the form reappears after validation, the pulldown menu...
1
6636
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 the select box to retain their values after hitting the Go-Submit button when selecting the 3 choices- they want to see the values retained on the next page when you look at the form. Below is the include file used to generate the dynamic...
2
1903
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 where the pulldown menu appears on top of the push button that causes an action when the field content is changed. It is unnescessary and causes an extra click in a very click intensive form. Can it be turned off for the entire page as well? That...
6
8656
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 queries by evaluating whether the data has been changed since last query. What should I do? -Jason
4
8823
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, but when they scroll up, the positioning gets confused. If the ComboBox contains record 60-79, and they pressed Up on 60, I trap the keypress and add records 40-59. I set the SelectedItem to 59, and the SelectedIndex to its index, and the textbox...
4
1918
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 'screen' the same, after they started edit them. First one changes datas and submit changes (sucessfully). Database (set tables - inserts/updates/deleting) was changed. At this point, datas which second user is watching are not valid anymore. They...
10
12316
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 database table using INSERT.... (field1) ...VALUES ......... (N'Characters'). How do I do this using Rs.Update viz-a-viz:
30
3411
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 commits it. How does the other user get the updated view without polling for changes? Is there some sort of callback mechanism that can be set up on the dataset or connection? TIA
0
9825
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9672
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10854
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9388
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7794
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5652
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5829
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3116
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.