Closed Bug 432849 Opened 16 years ago Closed 2 years ago

javascript form submission does not work on hidden form, js processed in wrong order

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: glillibridge, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14

This is a multi iframe page. One iframe, after processing, needs to have several other iframes refresh themselves. This works fine through the sequence of commands:

var fele = document.getElementById("iframe1"+list_applicant_place) ;
fele.contentWindow.location.reload(true);

One of iframes has gone through its own posting, and this causes that so annoying message "This page cannot be refreshed without resending the information...". So I rewrote that particular iframe and the parent page. The iframe that realizes the need to refresh, setS a flag in the parent. 
The code is: 

function refresh_list_schedule_iframe() {
    refresh_schedule_tab = 1 ;
    //alert(refresh_schedule_tab+"===refresh_list_schedule_iframe===") ;
    }
function cani_refresh_sched() {
   if (refresh_schedule_tab > 0 ) {
        //alert(refresh_schedule_tab+"===refresh_list_schedule_iframe===") ;
	refresh_schedule_tab = -1 ;
	return true ;
	}
      else {
	return false ;
	}
    }

The iframe that needs to be refreshed has a new function:

refreshform() ;
function refreshform() {
	if ( parent.cani_refresh_sched() ) {  //4
		//alert("====refreshform yes===========") ; //5
		document.forms['viewer'].submit();
		}
	setTimeout("refreshform()",150) ;
	}

That calls the parent to check if the flag is set. If it is, then it resubmits its form with the values in its fields.

This all works in IE7. The alert messages come out in the right order too.
In FF the alert message from iframe (alert("====refreshform yes===========")) comes out before the message from it parent (alert(refresh_schedule_tab+"===refresh_list_schedule_iframe===")) (//5), which is called on the line before(//4). And the submit form (document.forms['viewer'].submit();) does not take place. Code for form follows:

	<form name="viewer" action="" method="post">
    <strong>Training Center: </strong><br />
Sort&nbsp; <select name='sort' onChange='document.viewer.submit();'; ><option value=''> - choose - </option><option value='cl.CraftName' >Craft</option><option value='ScheduleID' selected >Schedule</option><option value='StartDate' >Start Date</option></select>&nbsp;&nbsp;&nbsp;<select name="TrainingCenter" id="TrainingCenter" tabindex="1"><option  value="AGTC">Arroyo Grande Training Center</option><option  value="BTC">Bakersfield Training Center</option><option  value="LATT">Los Angeles Trade Tech</option><option  value="OTC">Ontario Training Center</option><option  value="OCTC">Orange County Training Center</option><option  value="SDTC">San Diego Training Center</option><option  value="STC">Sylmar Training Center</option><option  value="VTC">Ventura Training Center</option><option SELECTED value="WTC">Whittier Training Center</option></select> Craft: <select name='CraftSelect' style='vertical-align:middle' ><option value=''> - choose - </option><option value='acoustical' >Acoustical</option><option value='carpreg' >Carpenter</option><option value='carpenter' >Carpenter Residential</option><option value='diver' >Diver</option><option value='drywallapp' >Drywall APP</option><option value='floorlayer' >Floorlayer</option><option value='industrialnoncon' >Industrial Non-Construction</option><option value='insulator' >Insulator</option><option value='latherer' >Lather</option><option value='masonry' >Masonry</option><option value='millcabinet' >Mill Cabinet</option><option value='millwright' >Millwright</option><option value='modulartinst' >Modular Installer</option><option value='painter' >Painter</option><option value='piledriver' >Piledriver</option><option value='plasterer' >Plasterer</option><option value='scaffold' >Scaffold Erector</option><option value='terrazzo' >Terrazzo</option><option value='tiltup' >Tilt Up</option></select>    <input type="hidden" name='popup' value="true"  />

    <input type="hidden" name='View_Schedules' value="1"  />
    <input type="button" value="View Schedules" onClick="document.viewer.submit();" tabindex="8" />
    &nbsp;<input type="button" value="Close this tab" onClick="window.location = 'nill2.html?clear_app_list=Y';" />
</form>



Reproducible: Sometimes

Actual Results:  




Additional fact that may bear on this problem. The iframe to be refreshed, is at the time of this operation, within a parent div with style display set to none.
Product: Firefox → Toolkit
A more simplified test case would help here. Also, is this reproducible in Firefox 3?
Component: Form Manager → HTML: Form Submission
Product: Toolkit → Core
QA Contact: form.manager → form-submission
Component: HTML: Form Submission → DOM: Core & HTML

Closing this as resolved:incomplete since a reduced test case was not provided, the last activity on this issue was 13 years ago and the reporter can't be NI?ed since the account is disabled.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.