Guest hardhat Posted April 7, 2006 Share Posted April 7, 2006 Hi,i have a request page that pulls issuedates from an access table. This part works fine, what I need to do is pull in the issuedate and the associated deadline from the access table to the FORM.I have got it working so that I get the information I need, displayed on the screen, but I need to get this data written back to a seperate table in the access db. what I need to ensure is the the FORM REQUEST input fields are set with the correct information.The code below shows what I have already got, and probably helps explain better that I written above .. function enterdeadline() {document.getElementById("timedeadline").value=document.getElementById("issuedate").value;} <tr><td bgcolor="#FFFFFF"><font face="Arial" size="2">Cover Date: </td> <td colspan="3"> <select name="issuedate" id="issuedate" size="1" onchange="enterdeadline()"> <% Dim strSQLissuedate, RSissuedate, currentissuedateDim strRecordsissuedate, strrecordsdeadlineSet RSissuedate = Server.CreateObject("ADODB.Recordset")strSQLissuedate = "Select * from timeissuedates order by unique"RSissuedate.Open strSQLissuedate, DB If Not RSissuedate.EOF Then strRecordsissuedate = "<OPTION VALUE='0'>" Do While Not RSissuedate.EOF strRecordsissuedate = strRecordsissuedate _ & "<OPTION VALUE='" & RSissuedate("timedeadline") & "'>" & RSissuedate("issuedate") & "</option>" & vbCrLf RSissuedate.MoveNext Loop Else strRecordsissuedate = "<OPTION VALUE='0'>No records found" End if Response.Write strRecordsissuedate strRecordsissuedate = "" RSissuedate.Close %> </SELECT></font></td> </td> </tr> <tr><td bgcolor="#FFFFFF"><font face="Arial" size="2">Deadline:</td> <td colspan="3"> <input type="text" id="timedeadline" name="timedeadline" value="" size="25"> </td> </tr> what I need to do, is get the value of the issuedat & timedeadline input fields to be representative of what is looked up in the access table.Can anyone see an easy way of doing this ? Link to comment Share on other sites More sharing options...
vinphetamin Posted April 13, 2006 Share Posted April 13, 2006 If i understand you correctly something like this perhaps:When you get your results from the database you could try concatenating two values as one...ie your select statement may look something like this:("SELECT timedeadline+'@@'+issuedate AS thisDate FROM timeissuedates ORDER BY unique")You could then use thisDate as the value for your drop-down-box.After the user changes the value of the drop-down the sub is called. The sub then gets the value of the drop-down and splits it in two values where @@ exists. It then updates the form with the values. <script language="vbscript"><!-- sub update() iStr=trim(results.value) if replace(iStr,"@@","")<>"" then iExist=instr(iStr,"@@") if iExist>0 then iDate=right(iStr,len(iStr)-iExist-1) iValue=left(iStr,iExist-1) end if else iDate="" iValue="" end if document.myForm.test.value=iDate document.myForm.test2.value=iValue end sub--></script><select onchange="update()" name="results"> <option value="">Please Select</option> <option value="one@@01/01/2007">1</option> <option value="two@@02/01/2007">2</option> <option value="three@@03/01/2007">3</option></select><form name="myForm"> <input type=text name=test readonly /> <input type=text name=test2 readonly /></form> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now