Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

input button

Status
Not open for further replies.

yuchieh

MIS
Joined
Jul 21, 2000
Messages
178
Location
US
I have an input button in the form
<input TYPE=&quot;Button&quot; name=&quot;download&quot; ONCLICK=&quot;location='downloadref.cfm?UpdateItem=#getreflist.controlNumber#'&quot; VALUE=&quot;Download Reference&quot;>

When the button is clicked, go to the other page, using cfobject, ActivePDF to show a downloadable PDF form. The form shows fine. I would like to have the PDF form be opened in a new window. So I used the following ..

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
function popWindow(file,window,params)
{destWindow=open(file,window,params);
if (destWindow.opener == null) destWindow.opener = self;
destWindow.focus();
}
</SCRIPT>

<input TYPE=&quot;Button&quot; name=&quot;download&quot; ONCLICK=&quot;javascript:popWindow('downloadref.cfm?UpdateItem=#getreflist.controlNumber#','destWindow');&quot; VALUE=&quot;Download Reference&quot;>

Then I got file download window and asked to choose &quot;save&quot; or &quot;open&quot;. either one, I would get an error.

The above onclick coding works fine in <a href=&quot;&quot;>. So my question is how to open a new window using input button.

Thanks

 
Could you simply use a target attribute for the form instead? It would be easier than fighting with javascript.

Code:
<form action=&quot;downloadref.cfm&quot; target=&quot;_blank&quot; method=&quot;GET&quot;>
  <input type=&quot;hidden&quot; name=&quot;UpdateItem&quot; value=&quot;#getreflist.controlNumber#&quot;>
  <input type=&quot;submit&quot; name=&quot;download&quot; value=&quot;Download Reference&quot;>
</form>




-Carl
 
There are othre submit buttons on this page, which is much more complicated than what I posted. So, I have to use input button for this one.
 
Not really.
You simply wrap each submit button in it's own form. You can have as many individual forms on a page as you care to.

Code:
<table>
<CFOUTPUT query=&quot;getreflist&quot;>
   <tr>
     <td>#getreflist.reference_title#</td>
     <td>
       <form action=&quot;downloadref.cfm&quot; target=&quot;_blank&quot; method=&quot;GET&quot;>
         <input type=&quot;hidden&quot; name=&quot;UpdateItem&quot; value=&quot;#getreflist.controlNumber#&quot;>
         <input type=&quot;submit&quot; name=&quot;download&quot; value=&quot;Download Reference&quot;>
       </form>
     </td>
   </tr>
</CFQUERY>
</table>

So you'd have one form for each reference.


-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top