Resend...didn't see it hit the list, sry if it's a repeat

The opener stays should stay as is. There is a problem with my code
though that I didn't see until now. The elem.target should be changed
to '' if elem.type = complete, because if the close the window after
previewing, the target needs to be reset. Also the onclick event may
need to return true for the form to actually submit. I didn't test
this :) onclick="setFormParams(this.form, 'complete'); return true;"

If he wants to have a close window button that submits the opener form
I'd do something line
opener.setFormParams(opener.forms.letter,'complete') from the popup.

In thinking about it again, the problem with this method is that you
still want to control the size of the popup. Probably the best way to
solve that using this method would be to create the window named "new"
before submitting the form.

So a somewhat debugged version might look like this.

<script>
function setFormParams(elem, type) {
  if (type == 'preview') {
     elem.action = 'letterPreview.cfm';
     elem.target = 'new';
  else if (type == 'complete') {
     elem.action = 'completeForm.cfm';
     elem.target = '';
}
window.open('null.htm','new', ...)
elem.submit();
</script>

<form id="letter">
<input type="submit" id="preview" value="preview" onclick="setFormParams(this.form, 
'preview'); return true">
<input type="submit" id="complete" value="sumbit" onclick="setFormParams(this.form, 
'complete'); return true">
</form>

-- 
jon
mailto:[EMAIL PROTECTED]

Sunday, December 15, 2002, 5:36:53 PM, you wrote:

G> ----- Original Message -----
G> From: "Jon Hall" <[EMAIL PROTECTED]>
>> Your making it to complex I think. Just submit the form using
>> target="new". Something like this...
>>
>> <script>
>> function setFormParams(elem, type) {
>>   if (type == 'preview') {
>>      elem.action = 'letterPreview.cfm';
>>      elem.target = 'new';
>>   else if (type == 'complete') {
>>      elem.action = 'completeForm.cfm';
>> }
>> elem.submit();
>> </script>
>>
>> <form id="letter">
>> <input type="submit" id="preview" value="preview"
G> onclick="setFormParams(this.form, 'preview')">
>> <input type="submit" id="complete" value="sumbit"
G> onclick="setFormParams(this.form, 'complete')">
>> </form>
G> ----------------------------

G> I'm curious (and too immersed in something else to set up a test ;-)... What
G> happens to the opener, the parent window contents, when you submit to the
G> preview pop-up? Does the browser know not to reload anything into here when
G> it's submitted a form to another window?

G> Gyrus
G> [EMAIL PROTECTED]
G> work: http://www.tengai.co.uk
G> play: http://www.norlonto.net
G> PGP key available

G> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to