Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

list box set to accept multiple entrys

Status
Not open for further replies.
Aug 1, 2003
85
US
I have a list box set to accept multiple. I have three names in it...Justin Jeff Dan. When I click on the dynamic button and select value equal to <%= (Recordset1.Fields.Item("Res_By").Value) %> , I get 1 name returned(highlighted) but not when I select multiple names. I assmue it's because the field on a multiple select would be Justin, Dan (for example) and that wouldn't match the list menu entries.
Any ideas??

Thanks,
Dan
 
did not understand the question? Can you explain it more clearly...

Thanks

-DNG
 
You could use the Split() function to convert your comma separated string into an array. Then step through the array with a For/Next loop to process it.
 
as Sheco Suggested you need to do this...

myvalues=Split(request.form("mylistbox",",")

then you can use...

for i=0 to UBOUND(myvalue)
'get your values here
next

-DNG
 
For DotNetGnat;
I made a select list box
[<select name="Res_by" size="3" multiple="multiple" id="Res_by">]
With the names Justin Jeff Dan in the list. I set it to select dynamically the name that is in the field. If I were to click on two names then nothing is higlighted. Does that help? BTW I'm Using Dreamweaver MX.

For Sheco;
Say what?! 0,o Do you have example code or should I start looking into the Split() function?
 
[red]If I were to click on two names then nothing is higlighted.[/red]

?????...do you mean that you get no value...

i already showed you sample code for split() function.

-DNG
 
danblack30,

Perhaps I misunderstood the question. I thought you were dealing with the issues that come up when processing an HTML form that uses a multiple select box.

Now it sounds like you are saying you have this:
[tt]
<select name="Res_by" size="3" multiple="multiple" id="Res_by">
<option value='Tom' selected>Tom</option>
<option value='Dick'>Dick</option>
<option value='Harry' selected>Harry</option>
</select>
[/tt]


 
I was writing my post when you submitted yours. LOL
Anyway, If you click on one name and submit the form, when the page refreshes that name is automatically highlighted. But if you select 2 names nothing is highlighted. I hope I'm getting my point across. Let me know
Dan

BTW here is the code from the slecet box

<select name="Res_by" size="3" multiple="multiple" id="Res_by">
<option value="Justin" <%If (Not isNull((Recordset1.Fields.Item("Res_By").Value))) Then If ("Justin" = CStr((Recordset1.Fields.Item("Res_By").Value))) Then Response.Write("SELECTED") : Response.Write("")%>>Justin</option>
<option value="Jeff" <%If (Not isNull((Recordset1.Fields.Item("Res_By").Value))) Then If ("Jeff" = CStr((Recordset1.Fields.Item("Res_By").Value))) Then Response.Write("SELECTED") : Response.Write("")%>>Jeff</option>
<option value="Dan" <%If (Not isNull((Recordset1.Fields.Item("Res_By").Value))) Then If ("Dan" = CStr((Recordset1.Fields.Item("Res_By").Value))) Then Response.Write("SELECTED") : Response.Write("")%>>Dan</option>
</select>
 
see now thats the thing...when you select two names...your
variable

Recordset1.Fields.Item("Res_By").Value="Justin,Jeff"

and this does not satisfy any of your conditions...and hence the reason for none being highlighted...

-DNG
 
Can you open up your database and look at the field that was just updated or inserted?

Do you have 2 rows, one for each name?

Or do you have 1 row with two names?

If you have 1 row with "Justin, Dan" then you see that won't match any of the IF/THEN tests in your ASP above.

So you can use the Split() function either on the page where you do the input, to make 1 row for each selected person.

Or you can use the Split() function when you build your output.

 
Yeah, what he said!

(we must have been posting at the same time)
 
The database has 1 column for res_by with muliptle rows. IF one name is selected(Justin) then the databse has Justin in that column. If two names are selected(Justin Jeff) then the column has "Justin, Jeff" in it.
 
first...i would suggest you to redesign your database...you are going to face more problem down the road...

but to solve the current issue you need to do...

myarray=split(yourdbvalue,",")

then

your myarray(0)= Justin
myarray(1)=Jeff

and you need to change your if statements too...

-DNG


 
It might be easier to seperate the names in to three columns(Res_by 1,2,3) and use checkbox's on the page. I think I'll try that first.
 
That will work as long as you are sure there will only ever be 3 names.

If there were 100 possibilities that wouldn't really be a good solution and you'd want to redo the database table structure.
 
What do you suggest for the structure? I just have 1 table, everything goes into about 15 columns and the rows are being populated with an insert from one form and an update from another form which has the resolved by field. Right now there are only 3 peeps in IT including me but there could be more in the future. So I could get away with the checkboxes for now, but I see how having a hundred possiblities could create problems.
I haven't worked with arrays or the split function yet so it's a little overwhelming. But thanks for the effort it is greatly appreciated.
 
So this is a database for tracking IT requests?

Suppose you have a table that holds rows about your IT staff:
[tt]
ITPerson
-------------
ITPersonID (unique primary key number)
Name (character string)
Active (true/false flag)
<other fields describing an ITPerson>
[/tt]

And then of course you have a table for helpdesk requests:
[tt]
HelpRequest
-----------
RequestID (unique primary key number)
RequestDate (datetime)
ProblemText (character string)
[/tt]

And finally you have a table for resolved issues
[tt]
Resolutions
-----------
RequestID (number --> Foriegn key to HelpRequest table)
ITPersonID (number --> Foriegn key to ITPerson table)
ResolvedDate (datetime)
Notes (character string)
[/tt]


If you use something like this then multiple IT people can participate in the resolution and each person can have their own notes about the problem.
 
You might also add a column to the HelpRequest table that identifies the person that needs help.
 
why not just have the table with even the resolved information

HelpRequest
-----------
RequestID (unique primary key number)
RequestDate (datetime)
ProblemText (character string)
ResolvedDate
ResolvedBy [red](ITPersonId who resolved/working on the issue) [/red]
AdditionalNotes
Active [red](true/false flag to indicate whether the problem is resolved or not)[/red]

so i think only two tables are sufficient...

-DNG
 
in the above table Resolved by the foreign key referring to the ITPerson table...and you set the Active flag to 0 only when the problem is completed resolved...

becasue a problem can be worked on many stages...you dont need to set this flag at each stage...it should be set only when the problem is solved and problem ticket is completely closed...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top