Dropdowns

Results 1 to 4 of 4

Thread: Dropdowns

  1. #1
    EvE Guest

    Default Dropdowns

    I want to know if it is possible to embed dropdowns in an ASP application as you would in a normal business app using normal visual (or other)languages.<BR>For example<BR>Assume that I am choosing all details for an employee from an employee table using his/her employee number.<BR><BR>I want certain fields to have the original chosen values displayed, but all the other options must be in a dropdown, in case the employee wants to update that value. The "other" options are from a table as well. A good example would be Title or Language.<BR><BR>I need to find out how to accomplish this.<BR><BR>Oh, and while I am at it, does any one know how to mask a text field? I would like users to enter a date as DD/MM/YYYY. I did put that on screen, but I wondered if it was forceable at all.<BR><BR>If anyone can help, please let me know!<BR>Thanks in advance<BR>Regards<BR>EvE

  2. #2
    Jason Buck Guest

    Default RE: Dropdowns

    Below I have include my whole page of source.<BR><BR>You can grab all the fields for your dropdown with ASP.<BR>First thing you do is write the original table and values to your html page. Then you bind your dropdowns to each of the values for that specific field.<BR>Then when you submit, you submit the value from the select Item and not the original table item.<BR><BR>If this is not clear, please feel free to contact me.<BR><BR>Respectfully,<BR><BR>Jason<BR>webmaster @wnj.com<BR><BR>&#060;!--#include virtual="/te/checklogin.asp" --&#062;<BR>&#060;html&#062;<BR>&#060;head&#062;&#06 0;title&#062;Warner Norcross and Judd LLP&#060;/title&#062;<BR>&#060;meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"&#062;<BR>&#060;meta HTTP-EQUIV="REFRESH"&#062;<BR><BR>&#060;/head&#062;<BR><BR><BR><BR>&#060;body onload="window.status=&#039Warner Norcross and Judd LLP&#039"; return true bgcolor="FFFFFF"&#062;<BR>&#060;center&#062;<BR>&# 060;!--#include virtual="/te/header.txt" --&#062;<BR>&#060;!--#include virtual="/te/menu.txt" --&#062;<BR>&#060;form method="Post" action="updateclient.asp"&#062;<BR><BR>&#060;table &#062;<BR><BR>&#060;%<BR><BR>strClientID = request.querystring("climat")<BR>Response.write strClientID<BR><BR>strConnect = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:database e1.mdb"<BR><BR>dim objconn, objrec, mysql, strStatus, Mytest, strLength<BR>set objconn = server.createobject("ADODB.Connection")<BR><BR><BR >objConn.open strConnect<BR><BR><BR>mysql = "SELECT CLIENT.CLIMAT, CLIENT.CLINAME, CLIENT.STATE, CLIENT.HUSB_DOB, CLIENT.WIFE_DOB, CLIENT.RESP_ATTY, CLIENT.CORP_FIDUC, CLIENT.ATTY_FIDUC, CLIENT.HUASSET, CLIENT.WIASSET, CLIENT.COASSET, CLIENT.MEMO, CLIENT.ORIGDATE, CLIENT.MODDATE, CLIENT.MODTIME, CLIENT.MODWHO, CLIENT.OFFICE FROM CLIENT WHERE (((Client.Climat)=&#039" & strClientID & "&#039));"<BR><BR><BR><BR><BR>set rstemp = objConn.execute(mysql)<BR><BR> <BR>strClimat = rstemp("CLIMAT")<BR>strCliname = rstemp("CLINAME")<BR>strState = rstemp("state")<BR>strhusbdob = rstemp("husb_dob")<BR>strwifedob = rstemp("wife_dob")<BR>strrespatty = rstemp("resp_atty")<BR>strcorpfid = rstemp("corp_fiduc")<BR>strattyfid = rstemp("atty_fiduc")<BR>strhuasset = rstemp("huasset")<BR>strwiasset = rstemp("wiasset")<BR>strcoasset = rstemp("coasset")<BR>strmemo = rstemp("memo")<BR>strorgdate = rstemp("origdate")<BR>strmoddate = rstemp("moddate")<BR>strmodtime = rstemp("modtime")<BR>strmodwho = rstemp("modwho")<BR>stroffice = rstemp("office")<BR><BR><BR>&#039howmanyfields=rst emp.fields.count -1<BR><BR>If not rstemp.eof then<BR><BR><BR> Do While Not rstemp.EOF<BR><BR> rstemp.movenext<BR> Loop<BR><BR> <BR><BR>End if<BR>rstemp.close<BR><BR>%&#062;<BR><BR><BR>&#060 ;tr&#062;<BR>&#060;td&#062;Climat&#060;/td&#062;&#060;input type="hidden" name="climat" size="20" value="&#060;%=strClimat%&#062;"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Clien t Name&#060;/td&#062;&#060;td&#062;&#060;input type="text" name="cliname" size="40" value="&#060;%=strCliname%&#062;"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#039*********This is where you bind the dropdown list to the<BR>&#039*********Initial Table value.<BR>&#060;td&#062;State&#060;/td&#062;&#060;td&#062;&#060;input type="Hidden" name="state" size="04" value="&#060;%=strState%&#062;"&#062;<BR>&#060;%<B R>mysql = "SELECT state.id, state.name FROM state WHERE (((state.id)&#062;&#039""&#039));"<BR><BR>set rstemp=objConn.execute(mysql)<BR><BR><BR>response. write "&#060;select name=&#039selstate&#039&#062;"<BR><BR>If not rstemp.eof then<BR><BR><BR> Do While Not rstemp.EOF<BR>strstateValue = rstemp("id")<BR>strst = rstemp("name")<BR> If strstate = strstateValue Then<BR> response.write "&#060;Option Selected value=" & strstateValue & "&#062;" & strst & "&#060;/option&#062;"<BR> Else<BR> response.write "&#060;Option value=" & strstateValue & "&#062;" & strst & "&#060;/option&#062;"<BR> End if<BR> rstemp.movenext<BR> Loop<BR><BR> <BR>response.write "&#060;/select&#062;"<BR>End if<BR><BR> rstemp.close<BR> <BR><BR><BR>%&#062;<BR><BR><BR><BR>&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Husban d DOB&#060;/td&#062;&#060;td&#062;&#060;input type="text" name="hdob" size="10" value="&#060;%=strhusbdob%&#062;"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Wife DOB&#060;/td&#062;&#060;td&#062;&#060;input type="text" name="wdob" size="10" value="&#060;%=strwifedob%&#062;"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Respon sible Attorney&#060;/td&#062;&#060;td&#062;&#060;input type="hidden" name="respatty" size="4" value="&#060;%=strrespatty%&#062;"&#062;<BR>&#060; %<BR>mysql = "SELECT attytbl.attyid, attytbl.attyname FROM Attytbl WHERE (((attytbl.attyid)&#062;&#039""&#039));"<BR><BR>se t rstemp = objConn.execute(mysql)<BR><BR><BR>response.write "&#060;select name=&#039selrespatty&#039&#062;"<BR><BR>If not rstemp.eof then<BR><BR><BR> Do While Not rstemp.EOF<BR>strOptionValue = rstemp("attyid")<BR>strOption = rstemp("attyname")<BR> If strrespatty = strOptionValue Then<BR> response.write "&#060;Option Selected value=" & strOptionValue & "&#062;" & strOption & "&#060;/option&#062;"<BR> Else<BR> response.write "&#060;Option value=" & strOptionValue & "&#062;" & strOption & "&#060;/option&#062;"<BR> End if<BR> rstemp.movenext<BR> Loop<BR><BR> <BR>response.write "&#060;/select&#062;"<BR>End if<BR><BR> rstemp.close<BR> <BR><BR><BR>%&#062;<BR>&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Corpor ate Fiducary&#060;/td&#062;&#060;td&#062;&#060;input type="hidden" name="corpfid" size="04" value="&#060;%=strcorpfid%&#062;"&#062;<BR>&#060;% <BR>mysql = "SELECT cftbl.cfcode, cftbl.cfname FROM cftbl WHERE (((cftbl.cfcode)&#062;&#039""&#039));"<BR><BR>set rstemp = objConn.execute(mysql)<BR><BR><BR>response.write "&#060;select name=&#039selcorpfid&#039&#062;"<BR><BR>If not rstemp.eof then<BR><BR><BR> Do While Not rstemp.EOF<BR>strcorpfidValue = rstemp("cfcode")<BR>strcorpfidstr = rstemp("cfname")<BR> If strcorpfid = strcorpfidValue Then<BR> response.write "&#060;Option Selected value=" & strcorpfidValue & "&#062;" & strcorpfidstr & "&#060;/option&#062;"<BR> Else<BR> response.write "&#060;Option value=" & strcorpfidValue & "&#062;" & strcorpfidstr & "&#060;/option&#062;"<BR> End if<BR> rstemp.movenext<BR> Loop<BR><BR> <BR>response.write "&#060;/select&#062;"<BR>End if<BR><BR> rstemp.close<BR> <BR><BR><BR>%&#062;<BR><BR>&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Attorn ey Fiducary&#060;/td&#062;&#060;td&#062;&#060;input type="hidden" name="attyfid" size="04" value="&#060;%=strattyfid%&#062;"&#062;<BR>&#060;% <BR>mysql = "SELECT attytbl.attyid, attytbl.attyname FROM Attytbl WHERE (((attytbl.attyid)&#062;&#039""&#039));"<BR><BR>se t rstemp=objConn.execute(mysql)<BR><BR><BR>response. write "&#060;select name=&#039selattyfid&#039&#062;"<BR><BR>If not rstemp.eof then<BR><BR><BR> Do While Not rstemp.EOF<BR>strattyfidValue = rstemp("attyid")<BR>strattyfidstr = rstemp("attyname")<BR> If strattyfid = strattyfidValue Then<BR> response.write "&#060;Option Selected value=" & strattyfidValue & "&#062;" & strattyfidstr & "&#060;/option&#062;"<BR> Else<BR> response.write "&#060;Option value=" & strattyfidValue & "&#062;" & strattyfidstr & "&#060;/option&#062;"<BR> End if<BR> rstemp.movenext<BR> Loop<BR><BR> <BR>response.write "&#060;/select&#062;"<BR>End if<BR><BR> rstemp.close<BR> <BR><BR><BR>%&#062;<BR><BR>&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Husban d Assets&#060;/td&#062;&#060;td&#062;&#060;input type="hidden" name="hasset" size="4" value="&#060;%=strhuasset%&#062;"&#062;<BR>&#060;% <BR>mysql = "SELECT assetbl.assetid, assetbl.loval, assetbl.hival FROM assetbl WHERE (((assetbl.assetid)&#062;0));"<BR><BR>set rstemp = objConn.execute(mysql)<BR><BR><BR>response.write "&#060;select name=&#039selhuasset&#039&#062;"<BR><BR>If not rstemp.eof then<BR><BR><BR> Do While Not rstemp.EOF<BR>strhuassetValue = rstemp("assetid")<BR>strhuassetstr = rstemp("loval") & " to " & rstemp("hival")<BR> If strhuasset = strhuassetValue Then<BR> response.write "&#060;Option Selected value=" & strhuassetValue & "&#062;" & strhuassetstr & "&#060;/option&#062;"<BR> Else<BR> response.write "&#060;Option value=" & strhuassetValue & "&#062;" & strhuassetstr & "&#060;/option&#062;"<BR> End if<BR> rstemp.movenext<BR> Loop<BR><BR> <BR>response.write "&#060;/select&#062;"<BR>End if<BR><BR> rstemp.close<BR> <BR><BR><BR>%&#062;<BR><BR><BR>&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Wife Assets&#060;/td&#062;&#060;td&#062;&#060;input type="hidden" name="wasset" size="04" value="&#060;%=strwiasset%&#062;"&#062;<BR>&#060;% <BR>mysql = "SELECT assetbl.assetid, assetbl.loval, assetbl.hival FROM assetbl WHERE (((assetbl.assetid)&#062;0));"<BR><BR>set rstemp = objConn.execute(mysql)<BR><BR><BR>response.write "&#060;select name=&#039selwiasset&#039&#062;"<BR><BR>If not rstemp.eof then<BR><BR><BR> Do While Not rstemp.EOF<BR>strwiassetValue = rstemp("assetid")<BR>strwiassetstr = rstemp("loval") & " to " & rstemp("hival")<BR> If strwiasset = strwiassetValue Then<BR> response.write "&#060;Option Selected value=" & strwiassetValue & "&#062;" & strwiassetstr & "&#060;/option&#062;"<BR> Else<BR> response.write "&#060;Option value=" & strwiassetValue & "&#062;" & strwiassetstr & "&#060;/option&#062;"<BR> End if<BR> rstemp.movenext<BR> Loop<BR><BR> <BR>response.write "&#060;/select&#062;"<BR>End if<BR><BR> rstemp.close<BR> <BR><BR><BR>%&#062;<BR><BR>&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Co Assets&#060;/td&#062;&#060;td&#062;&#060;input type="hidden" name="coasset" size="04" value="&#060;%=strcoasset%&#062;"&#062;<BR>&#060;% <BR>mysql = "SELECT assetbl.assetid, assetbl.loval, assetbl.hival FROM assetbl WHERE (((assetbl.assetid)&#062;0));"<BR><BR>set rstemp = objConn.execute(mysql)<BR><BR><BR>response.write "&#060;select name=&#039selcoasset&#039&#062;"<BR><BR>If not rstemp.eof then<BR><BR><BR> Do While Not rstemp.EOF<BR>strcoassetValue = rstemp("assetid")<BR>strcoassetstr = rstemp("loval") & " to " & rstemp("hival")<BR> If strcoasset = strcoassetValue Then<BR> response.write "&#060;Option Selected value=" & strcoassetValue & "&#062;" & strcoassetstr & "&#060;/option&#062;"<BR> Else<BR> response.write "&#060;Option value=" & strcoassetValue & "&#062;" & strcoassetstr & "&#060;/option&#062;"<BR> End if<BR> rstemp.movenext<BR> Loop<BR><BR> <BR>response.write "&#060;/select&#062;"<BR>End if<BR><BR> rstemp.close<BR> <BR><BR><BR>%&#062;<BR><BR>&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Memo&# 060;/td&#062;&#060;td&#062;&#060;textarea name="memo" cols=40 rows=5 &#062;&#060;%=strmemo%&#062;&#060;/textarea&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Origin al Date&#060;/td&#062;&#060;td&#062;&#060;input type="text" name="orgdate" size="10" value="&#060;%=strorgdate%&#062;"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Last Modified Date&#060;/td&#062;&#060;td&#062;&#060;input type="text" name="moddate" size="10" value="&#060;%=strmoddate%&#062;"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Time of Modification&#060;/td&#062;&#060;td&#062;&#060;input type="text" name="modtime" size="15" value="&#060;%=strmodtime%&#062;"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Modifi ed by &#060;/td&#062;&#060;td&#062;&#060;input type="text" name="modwho" size="10" value="&#060;%=strmodwho%&#062;"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;Offic e Location&#060;/td&#062;&#060;td&#062;&#060;input type="text" name="offloc" size="4" value="&#060;%=stroffice%&#062;"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;/table&#062;<BR>&#060;input type="submit" value="Submit" name="B1"&#062;&#060;input type="reset" value="Reset" name="B2"&#062;&#060;/form&#062;<BR><BR><BR><BR>&#060;/form&#062;<BR>&#060;/center&#062;<BR><BR>&#060;%<BR><BR>Set rstemp = nothing<BR>objConn.close<BR>set objConn = nothing<BR><BR>%&#062;<BR><BR>&#060;/body&#062;<BR>&#060;/html&#062;

  3. #3
    EvE Guest

    Default RE: Dropdowns

    Thank you very much Mr Buck.<BR>I still had a problem though, since it took me while to realise that I can not compare two integers to set the "Selected" value.<BR>I.e. I could not say<BR>If integer1=integer2 then <BR> &#039set selected<BR>else<BR> &#039etc<BR>end<BR><BR>I had to say<BR>If Cstr(integer1)=Cstr(integer2) then...<BR><BR>I am just wondering if this is good..?<BR>What will happen with dates??<BR><BR>Just a thought.<BR>Thank you for helping me get it right though ;-)<BR>Regards<BR>Yvette Fouché<BR>

  4. #4
    S Haq Guest

    Default Dropdown Question

    We are trying to access a simple dropdown box to an access database. We have list of items in the drop down box which is equal to the field= Name in the "chennier&#039 database. Afte the name is selected, we would like aan ASP page to show up with the full pics of the Name selected.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •