Posted on 2004-04-22
I have a basic ColdFusion form with input boxes and combo boxes. The combo boxes are populated by CF queries. After submittal of the form, I do some server side error checking on the action page. If an error occurs, I display the error to the user and provide a link (simply window.history.back()) for him or her to return to the form to correct data. Sounds simple right? Well, here is where the complication comes in...at least for me anyhow. One of the combo boxes has an "OnChange" event that causes other fields to be populated. If I don't select anything from that combo box and force the error, the history is retained, but if something is selected from that combo box and an error occurs, the history disappears. Not only the combo box info is gone, but all the other information that I filled in as well...just sends me back to a blank form. Any help would be appreciated!
The code is pretty simple on the action page...just the CF validation and the window.history.back(); link. Below is the combo box.
<cfquery name="QRY_JOB_TYPES" atasource="#LAP_DATA_SOURCE#">
SELECT JOB_TYPE_DESC, DEFAULT_DAYS
ORDER BY JOB_TYPE_DESC
<option value="" selected>
<option value="#QRY_JOB_TYPES.JOB_TYPE_DESC#"><font class="ArialBlk8">#QRY_JOB_TYPES.JOB_TYPE_DESC# (average completion in #QRY_JOB_TYPES.DEFAULT_DAYS# days)</font>
<!--- Opens a popup that displays a please wait message and populates estimated start and end dates based on the job type selected --->
var typeindex = document.frm_JOB_ADD.cmb_Type.selectedIndex;
var selectedtype = document.frm_JOB_ADD.cmb_Type.options[typeindex].value;
var mypath = "JOB_POPULATE_DEFAULT_DATES_AND_USER.cfm?URL_TYPE=" + escape(selectedtype) + "&URL_BEG_DATE=" + escape(document.frm_JOB_ADD.txt_EST_START_DATE.value);
window.open(mypath+"&random="+Math.random(),"mywin","scrollbars=1,left=190,top=160,width=160,height=80"); <!--- Opens Page And Refreshes Info From Server --->