Link to home
Start Free TrialLog in
Avatar of LeadCo
LeadCo

asked on

How do you execute javascript within a cfdiv ?

I have a page that uses cfdiv and the URL that is calld by the cfdiv is a form that the user fills out. When the user clicks to process the form their is some logic that  processing the form to check validity of data and then the info need to be posted to an external page that should open in a new window.

The issue:
page 1 opens cfdiv - form on cfdiv processes and will not open a new window even with target = "_blank".

Also I have javascript that auto submits form data for the validation page to the external page. If I could get the javascript to run the document.form.submit() it would be OK.

Howewer I am finding that javascript does not process in a cfdiv.
 
A solution to either would solve my problem:
Opening the form submit in a new window from the cfdiv
OR
Figure out how to run the javascript in cfdiv to auto subit form.

<!---  example --->
index.cfm with cfdiv area
 
<!---  cfdiv --->
<cfdiv bindonload="false" bind="url:Apprequest.cfm?idvar=#id#&apply={Apply@click}" />
 
<!---  the url : Apprequest.cfm--->
 
<cfform action="apply.cfm"  target="_blank" method="post">
fields .......
Submit
 
Even with the target = "_blank" it does not open in new window.  (1 st problem)
 
<!---  Next (we are still on Index.cfm we have processed the form )--->
 
<form action="http://www.URL/post.php" method="post" target="_blank" name="Apply">
hiddenfield
hiddenfield.....
  <script language="JavaScript">
<!--
document.Apply.submit();
//--
</script>
</form
 
<!---  This fails to submit ---->

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of azadisaryev
azadisaryev
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LeadCo
LeadCo

ASKER

How do i turn this into a function to be called?
<script language="JavaScript">
document.Apply.submit();
//--
</script>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LeadCo

ASKER

Perfect!