I have a page that has three forms on it. For the first two forms, the user selects a name from the list and it popuplates the rest of the fields for that form. On my third form, the user needs to select one of three radio buttons, then enter text to search for, then execute the query. I would like to have the third form's fields then populated with the results, as there can only be one record in the result set.
What is the best way to do this? I have my javascript functions to do the first two forms, but I can't figure out how to execute the query and get the results to the third form. My code is below. Thank you. <cfquery name="rsContact" datasource="PhysicianAccess"> SELECT * FROM dbo.ContactInfo</cfquery> <cfquery name="rsGroup" datasource="PhysicianAccess"> SELECT * FROM dbo.GroupInfo</cfquery> <cfquery name="rsPhysician" datasource="PhysicianAccess"> SELECT * FROM dbo.PhysicianInfo </cfquery> <cfquery name="rsDictationNo" datasource="PhysicianAccess"> SELECT * FROM dbo.PhysicianInfo WHERE DictationNo = '#FORM.DictationNo#' </cfquery> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <InvalidTag http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="../default.css" rel="stylesheet" type="text/css"> <InvalidTag language="JavaScript" type="text/JavaScript"> <!-- function GetDetails(Detail) { for (Loop=0; Loop < Detail.options.length; Loop++) { if (Detail.options[Loop].selected == true) { document.form1.SupervisorID.value = Detail.options[Loop].value; document.form1.FName.value = Detail.options[Loop].FirstName; document.form1.LName.value = Detail.options[Loop].LastName; document.form1.txtTitle.value = Detail.options[Loop].txtTitle; } } } function GetDetails2(Detail) { for (Loop=0; Loop < Detail.options.length; Loop++) { if (Detail.options[Loop].selected == true) { document.form2.GroupID.value = Detail.options[Loop].value; document.form2.Address1.value = Detail.options[Loop].Address1; document.form2.Address2.value = Detail.options[Loop].Address2; document.form2.City.value = Detail.options[Loop].City; document.form2.txtState.value = Detail.options[Loop].txtState; document.form2.Zip.value = Detail.options[Loop].Zip; } } } function getSelectedRadioValue(radioSearch) { if (document.form3.radioSearch[0].checked == true) { if (document.form3.DictationNo.value != "") { var valDictationNo = document.form3.DictationNo.value; document.form3.FName.value = "FName1"; document.form3.MI.value = "MI1"; document.form3.LName.value = "LName1"; document.form3.PreferredName.value = "PreferredName1"; document.form3.Title.value = "Title1"; document.form3.Degree.value = "Degree1"; document.form3.AccessExp.value = "AccessExp1"; } else { alert("Please enter a Dictation number") } } else if (document.form3.radioSearch[1].checked == true) { var valPhysicianID = document.form3.PhysicianID.value; document.form3.FName.value = "FName2"; document.form3.MI.value = "MI2"; document.form3.LName.value = "LName2"; document.form3.PreferredName.value = "PreferredName2"; document.form3.Title.value = "Title2"; document.form3.Degree.value = "Degree2"; document.form3.AccessExp.value = "AccessExp2"; } else if (document.form3.radioSearch[2].checked == true) { var valSSN = document.form3.SSN.value; document.form3.FName.value = "FName3"; document.form3.MI.value = "MI3"; document.form3.LName.value = "LName3"; document.form3.PreferredName.value = "PreferredName3"; document.form3.Title.value = "Title3"; document.form3.Degree.value = "Degree3"; document.form3.AccessExp.value = "AccessExp3"; } } function myFocus(element) { if (element.value == element.defaultValue) { element.value = ''; } } function myBlur(element) { if (element.value == '') { element.value = element.defaultValue; } } //--> </script> </head> <body> <table width="100%" border="1"> <tr> <td><form name="form1" method="post" action=""> <table width="100%" border="0"> <tr> <td colspan="2"><strong>Point of Contact (Manager, Supervisor):</strong></td> </tr> <tr valign="top"> <td height="45" colspan="2"><select name="ContactInfo" onChange="GetDetails(this)"> <option value=""></option> <cfoutput query="rsContact"> <option value="#rsContact.SupervisorID#" LastName="#rsContact.LName#" FirstName="#rsContact.FName#" txtTitle="#rsContact.Title#">#rsContact.LName#, #rsContact.FName# - #rsContact.Phone#</option> </cfoutput> </select> </td> </tr> <tr> <td width="85%">First Name: <input name="FName" type="text" id="FName" readonly> Last Name: <input name="LName" type="text" id="LName" readonly></td> <td width="15%"><input name="NewContact" type="button" id="NewContact" value="New Contact" onClick="window.open('NewContact.cfm')"></td> </tr> <tr> <td width="85%">Title: <input name="txtTitle" type="text" id="txtTitle" readonly> <input name="SupervisorID" type="hidden" id="SupervisorID2" disabled></td> <td width="15%"><input name="EditContact" type="submit" id="EditContact" value="Edit"></td> </tr> </table> </form></td> </tr> </table> <table width="100%" border="1"> <tr> <td><form name="form2" method="post" action=""> <table width="100%" border="0"> <tr> <td colspan="2"><strong>Physician Group Information: </strong></td> </tr> <tr valign="top"> <td height="45" colspan="2">Group Name/Physician: <select name="GroupName" id="GroupName" onChange="GetDetails2(this)"> <option value=""></option> <cfoutput query="rsGroup"> <option value="#rsGroup.GroupID#" Address1="#rsGroup.Address1#" Address2="#rsGroup.Address2#" City="#rsGroup.City#" txtState="#rsGroup.State#" Zip="#rsGroup.Zip#">#rsGroup.GroupName#</option> </cfoutput> </select> <input name="GroupID" type="hidden" id="GroupID"></td> </tr> <tr> <td width="85%">Address: <input name="Address1" type="text" id="Address1" readonly></td> <td width="15%"> </td> </tr> <tr> <td width="85%">Address (cont): <input name="Address2" type="text" id="Address2" readonly></td> <td width="15%"><input name="NewGroup" type="button" id="NewGroup" value="New Group" onClick="window.open('NewGroup.cfm')"></td> </tr> <tr> <td width="85%">City: <input name="City" type="text" id="City" readonly> State: <input name="txtState" type="text" readonly id="txtState" size="2"> Zip: <input name="Zip" type="text" readonly id="Zip" size="10"></td> <td width="15%"><input name="EditGroup" type="submit" id="EditGroup" value="Edit"></td> </tr> </table> </form></td> </tr> </table> <table width="100%" border="1"> <tr> <td><form name="form3" method="post" action=""> <table width="100%" border="0"> <tr> <td width="85%"><strong>Physician Information: </strong></td> <td width="15%"> </td> </tr> <tr valign="top"> <td width="85%" height="65"> <hr> <table width="100%" border="0"> <tr> <td width="10%" rowspan="3"><p>Search by:<br> </p> </td> <td><input class="border" name="radioSearch" type="radio" checked value="DictationNo"> Dictation # <input name="DictationNo" type="text" id="DictationNo" size="6" maxlength="6" ></td> </tr> <tr> <td><input class="border" name="radioSearch" type="radio" value="PhysicianID"> Physician Computer Account ID: <input name="PhysicianID" type="text" id="PhysicianID" size="20" maxlength="20"></td> </tr> <tr> <td><input class="border" name="radioSearch" type="radio" value="SSN"> Social Security #: <input name="SSN" type="text" id="SSN" size="12" maxlength="12"> (use dashes: 000-00-0000) </span></td> </tr> </table> <hr></td> <td width="15%" height="65"><input name="Search" type="button" id="Search" value="Search/Populate" onClick="getSelectedRadioValue()"></td> </tr> <tr> <td width="85%">First Name: <input name="FName" type="text" id="FName" readonly> MI <input name="MI" type="text" id="MI" size="1" readonly> Last Name: <input name="LName" type="text" id="LName" readonly></td> <td width="15%"> </td> </tr> <tr> <td width="85%">Preferred Name: <input name="PreferredName" type="text" id="PreferredName" readonly></td> <td width="15%"> </td> </tr> <tr> <td width="85%">Title: <input name="Title" type="text" id="Title" readonly></td> <td width="15%"> </td> </tr> <tr> <td width="85%">Degree: <input name="Degree" type="text" id="Degree" size="10" readonly></td> <td width="15%"> </td> </tr> <tr> <td width="85%">Access Expiration Date: <input name="AccessExp" type="text" id="AccessExp" size="12" readonly></td> <td width="15%"> </td> </tr> </table> </form></td> </tr> </table> </body> </html> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:15:697 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
