By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,089 Members | 2,283 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,089 IT Pros & Developers. It's quick & easy.

Update pulldown via disconnected rs? possible?

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
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

P: n/a
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

P: n/a

"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

P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.