Posting form into a new window

E

Eli

How can I POST a form into a new window where I control the size and
other attributes of the new window?

Also. Are there any implications, perhaps due to browser security
(Interne Explorer?) that could cause problems if I try to post a form
at www.mydomain.com to www.anotherdomain.com?
 
F

Frances Del Rio

Eli said:
How can I POST a form into a new window where I control the size and
other attributes of the new window?

Also. Are there any implications, perhaps due to browser security
(Interne Explorer?) that could cause problems if I try to post a form
at www.mydomain.com to www.anotherdomain.com?

not sure what you mean, but I've done forms in pop-ups a lot.. go here
and click at the bottom where it says "form":

http://www.francesdelrio.com/hbl/
 
E

Eli

not sure what you mean, but I've done forms in pop-ups a lot.. go here
and click at the bottom where it says "form":

http://www.francesdelrio.com/hbl/


No, that's not what I meant.

I wish to post from a form that appears on a web page (it's a visitor
poll) to an action= page that will appear in a newly opened window.
Using only target= in the <form> tag doesn't give you the ability to
control the window's size and attributes.
 
R

Randy Webb

You don't. It's *my* browser, stop trying to change it's size.

Ummm, why not test it? Hmmm.
not sure what you mean, but I've done forms in pop-ups a lot.. go here
and click at the bottom where it says "form":

http://www.francesdelrio.com/hbl/

What I get from that URL, when clicking "form", is navigated to
http://www.francesdelrio.com/hbl/#

so, before you quote a page as a reference, maybe you should validate
the page and test it in something besides IE.

But looking at the source of that page, you should ditch it, start over,
and end up (maybe) with something decent enough to use as an example?
 
F

fox

Eli said:
No, that's not what I meant.

I wish to post from a form that appears on a web page (it's a visitor
poll) to an action= page that will appear in a newly opened window.
Using only target= in the <form> tag doesn't give you the ability to
control the window's size and attributes.

Just create a "named" window with window open and submit the form to it
by setting the target to the newly created window name [there actually
*IS* a purpose for the second argument to window.open!]:

<form onsubmit = "return handleSubmit(this)">
.....

// the JS:

function
handleSubmit(f)
{
// f => form reference

// you can set these attributes in the form tag if you want
f.action = "script2call.ext";
f.method = "POST or GET"; // one OR the other
f.target = "myFormWindow";

// create your named window:
var w = window.open("","myFormWindow","AttributesList");

f.submit();
return false; // or navigate to another page...
}


I tested this in Mozilla with "Block unrequested popup windows" checked
-- and it still worked, but if the user has JS turned off, then this is
toast.. so:

<noscript>
<h3>This site requires JavaScript...</h3>

</noscript>
 
R

Randy Webb

fox wrote:

I tested this in Mozilla with "Block unrequested popup windows" checked
-- and it still worked, but if the user has JS turned off, then this is
toast.. so:

Why not just have a normal form, with an action attribute set, and let
it remain in the main window? The noscript element is not the best
place to explain that "I am too incompetent to make my site non-JS
dependent so you must use a browser that supports it and has it enabled"
 
E

Eli

Eli said:
No, that's not what I meant.

I wish to post from a form that appears on a web page (it's a visitor
poll) to an action= page that will appear in a newly opened window.
Using only target= in the <form> tag doesn't give you the ability to
control the window's size and attributes.

Just create a "named" window with window open and submit the form to it
by setting the target to the newly created window name [there actually
*IS* a purpose for the second argument to window.open!]:

<form onsubmit = "return handleSubmit(this)">
....

// the JS:

function
handleSubmit(f)
{
// f => form reference

// you can set these attributes in the form tag if you want
f.action = "script2call.ext";
f.method = "POST or GET"; // one OR the other
f.target = "myFormWindow";

// create your named window:
var w = window.open("","myFormWindow","AttributesList");

f.submit();
return false; // or navigate to another page...
}


I tested this in Mozilla with "Block unrequested popup windows" checked
-- and it still worked, but if the user has JS turned off, then this is
toast.. so:

<noscript>
<h3>This site requires JavaScript...</h3>

</noscript>

Hey, thanks a lot!

I found some code elsewhere that was very similar to what you've
posted, with the action, method and target set in the form tag (as you
note is possible). A couple of questions:

- Instead of "f.submit()" and "return false", would the single
statement "return true" accomplish the same thing, or is there a
difference?

- What is the difference between open() and window.open()? The other
code used open(), which I'd never used before.
 
E

Eli

On Sat, 25 Sep 2004 20:40:06 -0400, Randy Webb
Why not just have a normal form, with an action attribute set, and let
it remain in the main window? The noscript element is not the best
place to explain that "I am too incompetent to make my site non-JS
dependent so you must use a browser that supports it and has it enabled"

Why not go do something useful for somebody?
 
F

Frances Del Rio

Randy said:
You don't. It's *my* browser, stop trying to change it's size.



Ummm, why not test it? Hmmm.



What I get from that URL, when clicking "form", is navigated to
http://www.francesdelrio.com/hbl/#

so, before you quote a page as a reference, maybe you should validate
the page and test it in something besides IE.

But looking at the source of that page, you should ditch it, start over,
and end up (maybe) with something decent enough to use as an example?

gees, thanks... I guess some of us are more tolerant of mistakes than
others.. ;) it's working on netscape now.. in both English and Spanish..
(I test everything on IE and netscape.. this was an inadvertent
mistake... and whaddayaknow... it even works in that very quirky
broswer called 'Opera'...)
would have been nice if you had said what browser it's not working on
for you..

http://www.francesdelrio.com/hbl/index.html
 
R

Randy Webb

Frances said:
gees, thanks... I guess some of us are more tolerant of mistakes than
others.. ;) it's working on netscape now.. in both English and Spanish..
(I test everything on IE and netscape.. this was an inadvertent
mistake... and whaddayaknow... it even works in that very quirky
broswer called 'Opera'...)
would have been nice if you had said what browser it's not working on
for you..

http://www.francesdelrio.com/hbl/index.html

Of course, you are right. But it didn't work in Mozilla, and nicely, it
works now.

Still not sure why you use all the un-needed evals though.
 
F

Frances Del Rio

Randy said:
Of course, you are right. But it didn't work in Mozilla, and nicely, it
works now.

Still not sure why you use all the un-needed evals though.

you know, this is sthg I learned in a book a few years ago (don't
remember if it was the JS Bible or a DHTML book I used a few years ago
called "DHTML for the World Wide Web: Visual Quickstart Guide" by Jason
C. Teague, from that little book I learned to do the DHTML on this pg..
http://www.francesdelrio.com/dhtml/sonnets.html

and it has become kind of a bad habit.. a number of people here have
told me not to do that.. so: when is it ok to use evals?? thank you..
Frances
 
R

Randy Webb

Frances said:
Randy Webb wrote:



you know, this is sthg I learned in a book a few years ago (don't
remember if it was the JS Bible or a DHTML book I used a few years ago
called "DHTML for the World Wide Web: Visual Quickstart Guide" by Jason
C. Teague, from that little book I learned to do the DHTML on this pg..
http://www.francesdelrio.com/dhtml/sonnets.html

and it has become kind of a bad habit.. a number of people here have
told me not to do that.. so: when is it ok to use evals?? thank you..
Frances

I only know of two occasions to use it:

1) When executing unknown code. Example: A textarea where you paste in
code, and you eval it to get its resulting action. Its covered in the FAQ.

2) The second is a case I ran into myself, where I was trying to find
the most efficient way to convert a fraction to a decimal and it turned
out that eval was marginally faster. This one is not explicitly covered,
but it falls in the same category.

http://jibbering.com/faq/#FAQ4_40

Covers eval, and alludes to 3_39 which covers obtaining a reference to
an object. That was most of the eval uses I saw in your page. All of
which are now changed :)
 
F

Fox

Eli said:
Eli said:
Eli wrote:



How can I POST a form into a new window where I control the size and
other attributes of the new window?

Also. Are there any implications, perhaps due to browser security
(Interne Explorer?) that could cause problems if I try to post a form
at www.mydomain.com to www.anotherdomain.com?

not sure what you mean, but I've done forms in pop-ups a lot.. go here
and click at the bottom where it says "form":

http://www.francesdelrio.com/hbl/



No, that's not what I meant.

I wish to post from a form that appears on a web page (it's a visitor
poll) to an action= page that will appear in a newly opened window.
Using only target= in the <form> tag doesn't give you the ability to
control the window's size and attributes.

Just create a "named" window with window open and submit the form to it
by setting the target to the newly created window name [there actually
*IS* a purpose for the second argument to window.open!]:

<form onsubmit = "return handleSubmit(this)">
....

// the JS:

function
handleSubmit(f)
{
// f => form reference

// you can set these attributes in the form tag if you want
f.action = "script2call.ext";
f.method = "POST or GET"; // one OR the other
f.target = "myFormWindow";

// create your named window:
var w = window.open("","myFormWindow","AttributesList");

f.submit();
return false; // or navigate to another page...
}


I tested this in Mozilla with "Block unrequested popup windows" checked
-- and it still worked, but if the user has JS turned off, then this is
toast.. so:

<noscript>
<h3>This site requires JavaScript...</h3>

</noscript>


Hey, thanks a lot!

I found some code elsewhere that was very similar to what you've
posted, with the action, method and target set in the form tag (as you
note is possible). A couple of questions:

- Instead of "f.submit()" and "return false", would the single
statement "return true" accomplish the same thing, or is there a
difference?

Actually, if you want, you can delete both lines -- onsubmit handlers
return true by default.
- What is the difference between open() and window.open()? The other
code used open(), which I'd never used before.

window.open() is more correct...

open() will attempt to call that method on the "current object". I
suspect IE is much more lenient about this syntactical mistake. After
all, IE is a very "do what I *want* and not as I write" kind of
environment. There is also a document.open() as well that is very
different (it "opens" a document for writing with document.write() - it
does not open a new window.) Some browsers, or scripting environments
might complain if you are not more specific.
 
F

Frances Del Rio

FOX -- FOX??? is this the FOX that helped me a few years ago when I was
learning JavaScript (am still learning, of course, as you can see if you
come across my posts from the last few days.. am learning Java now, it's
hard, but I still enjoy it...) I remember you were a Netscape specialist
(old netscape, as in layers... ) I remember a really cool page you did
with little colored squares that jumped all over the page... I love
your current site, have been dissecting yr code...

scrollbar-base-color: #98a8b8;
filter: alpha (opacity=80);

CSS never ceases to amaze me.. I can only wonder what other stuff it has
up its sleeve that I don't know of.. I mean those semi-transparent
scrollbars take the cake!!

Frances

Eli said:
Eli wrote:

Eli wrote:



How can I POST a form into a new window where I control the size and
other attributes of the new window?

Also. Are there any implications, perhaps due to browser security
(Interne Explorer?) that could cause problems if I try to post a form
at www.mydomain.com to www.anotherdomain.com?


not sure what you mean, but I've done forms in pop-ups a lot.. go
here and click at the bottom where it says "form":

http://www.francesdelrio.com/hbl/




No, that's not what I meant.

I wish to post from a form that appears on a web page (it's a visitor
poll) to an action= page that will appear in a newly opened window.
Using only target= in the <form> tag doesn't give you the ability to
control the window's size and attributes.


Just create a "named" window with window open and submit the form to
it by setting the target to the newly created window name [there
actually *IS* a purpose for the second argument to window.open!]:

<form onsubmit = "return handleSubmit(this)">
....

// the JS:

function
handleSubmit(f)
{
// f => form reference

// you can set these attributes in the form tag if you want
f.action = "script2call.ext";
f.method = "POST or GET"; // one OR the other
f.target = "myFormWindow";

// create your named window:
var w = window.open("","myFormWindow","AttributesList");

f.submit();
return false; // or navigate to another page...
}


I tested this in Mozilla with "Block unrequested popup windows"
checked -- and it still worked, but if the user has JS turned off,
then this is toast.. so:

<noscript>
<h3>This site requires JavaScript...</h3>

</noscript>



Hey, thanks a lot!

I found some code elsewhere that was very similar to what you've
posted, with the action, method and target set in the form tag (as you
note is possible). A couple of questions:

- Instead of "f.submit()" and "return false", would the single
statement "return true" accomplish the same thing, or is there a
difference?


Actually, if you want, you can delete both lines -- onsubmit handlers
return true by default.
- What is the difference between open() and window.open()? The other
code used open(), which I'd never used before.


window.open() is more correct...

open() will attempt to call that method on the "current object". I
suspect IE is much more lenient about this syntactical mistake. After
all, IE is a very "do what I *want* and not as I write" kind of
environment. There is also a document.open() as well that is very
different (it "opens" a document for writing with document.write() - it
does not open a new window.) Some browsers, or scripting environments
might complain if you are not more specific.
 
F

Frances Del Rio

Fox, look what I did with your divs for netscape:

http://www.francesdelrio.com/fox/

heh heh... this is too cool.. I love your that image, it's beautiful...

Frances

Eli said:
Eli wrote:

Eli wrote:



How can I POST a form into a new window where I control the size and
other attributes of the new window?

Also. Are there any implications, perhaps due to browser security
(Interne Explorer?) that could cause problems if I try to post a form
at www.mydomain.com to www.anotherdomain.com?


not sure what you mean, but I've done forms in pop-ups a lot.. go
here and click at the bottom where it says "form":

http://www.francesdelrio.com/hbl/




No, that's not what I meant.

I wish to post from a form that appears on a web page (it's a visitor
poll) to an action= page that will appear in a newly opened window.
Using only target= in the <form> tag doesn't give you the ability to
control the window's size and attributes.


Just create a "named" window with window open and submit the form to
it by setting the target to the newly created window name [there
actually *IS* a purpose for the second argument to window.open!]:

<form onsubmit = "return handleSubmit(this)">
....

// the JS:

function
handleSubmit(f)
{
// f => form reference

// you can set these attributes in the form tag if you want
f.action = "script2call.ext";
f.method = "POST or GET"; // one OR the other
f.target = "myFormWindow";

// create your named window:
var w = window.open("","myFormWindow","AttributesList");

f.submit();
return false; // or navigate to another page...
}


I tested this in Mozilla with "Block unrequested popup windows"
checked -- and it still worked, but if the user has JS turned off,
then this is toast.. so:

<noscript>
<h3>This site requires JavaScript...</h3>

</noscript>



Hey, thanks a lot!

I found some code elsewhere that was very similar to what you've
posted, with the action, method and target set in the form tag (as you
note is possible). A couple of questions:

- Instead of "f.submit()" and "return false", would the single
statement "return true" accomplish the same thing, or is there a
difference?


Actually, if you want, you can delete both lines -- onsubmit handlers
return true by default.
- What is the difference between open() and window.open()? The other
code used open(), which I'd never used before.


window.open() is more correct...

open() will attempt to call that method on the "current object". I
suspect IE is much more lenient about this syntactical mistake. After
all, IE is a very "do what I *want* and not as I write" kind of
environment. There is also a document.open() as well that is very
different (it "opens" a document for writing with document.write() - it
does not open a new window.) Some browsers, or scripting environments
might complain if you are not more specific.
 
R

Randy Webb

Frances said:
FOX -- FOX??? is this the FOX that helped me a few years ago when I was
learning JavaScript (am still learning, of course, as you can see if you
come across my posts from the last few days.. am learning Java now, it's
hard, but I still enjoy it...) I remember you were a Netscape specialist
(old netscape, as in layers... ) I remember a really cool page you did
with little colored squares that jumped all over the page... I love
your current site, have been dissecting yr code...

scrollbar-base-color: #98a8b8;
filter: alpha (opacity=80);

CSS never ceases to amaze me.. I can only wonder what other stuff it has
up its sleeve that I don't know of.. I mean those semi-transparent
scrollbars take the cake!!

I guess if you use, and test, with IE, they could be cool, especially
since those two CSS properties are IE-only.
 
F

Fox

Frances said:
FOX -- FOX??? is this the FOX that helped me a few years ago when I was
learning JavaScript

Yes, Frances, I remember, too!
(am still learning, of course, as you can see if you
come across my posts from the last few days.. am learning Java now, it's
hard, but I still enjoy it...) I remember you were a Netscape specialist
(old netscape, as in layers... ) I remember a really cool page you did
with little colored squares that jumped all over the page... I love
your current site, have been dissecting yr code...

scrollbar-base-color: #98a8b8;
filter: alpha (opacity=80);

CSS never ceases to amaze me.. I can only wonder what other stuff it has
up its sleeve that I don't know of.. I mean those semi-transparent
scrollbars take the cake!!

Frances

Eli said:
Eli wrote:

Eli wrote:



How can I POST a form into a new window where I control the size and
other attributes of the new window?

Also. Are there any implications, perhaps due to browser security
(Interne Explorer?) that could cause problems if I try to post a
form
at www.mydomain.com to www.anotherdomain.com?



not sure what you mean, but I've done forms in pop-ups a lot.. go
here and click at the bottom where it says "form":

http://www.francesdelrio.com/hbl/





No, that's not what I meant.

I wish to post from a form that appears on a web page (it's a visitor
poll) to an action= page that will appear in a newly opened window.
Using only target= in the <form> tag doesn't give you the ability to
control the window's size and attributes.


Just create a "named" window with window open and submit the form to
it by setting the target to the newly created window name [there
actually *IS* a purpose for the second argument to window.open!]:

<form onsubmit = "return handleSubmit(this)">
....

// the JS:

function
handleSubmit(f)
{
// f => form reference

// you can set these attributes in the form tag if you want
f.action = "script2call.ext";
f.method = "POST or GET"; // one OR the other
f.target = "myFormWindow";
// create your named window: var w =
window.open("","myFormWindow","AttributesList");

f.submit();
return false; // or navigate to another page...
}


I tested this in Mozilla with "Block unrequested popup windows"
checked -- and it still worked, but if the user has JS turned off,
then this is toast.. so:

<noscript>
<h3>This site requires JavaScript...</h3>

</noscript>




Hey, thanks a lot!

I found some code elsewhere that was very similar to what you've
posted, with the action, method and target set in the form tag (as you
note is possible). A couple of questions:

- Instead of "f.submit()" and "return false", would the single
statement "return true" accomplish the same thing, or is there a
difference?



Actually, if you want, you can delete both lines -- onsubmit handlers
return true by default.
- What is the difference between open() and window.open()? The other
code used open(), which I'd never used before.



window.open() is more correct...

open() will attempt to call that method on the "current object". I
suspect IE is much more lenient about this syntactical mistake. After
all, IE is a very "do what I *want* and not as I write" kind of
environment. There is also a document.open() as well that is very
different (it "opens" a document for writing with document.write() -
it does not open a new window.) Some browsers, or scripting
environments might complain if you are not more specific.
 
F

Fox

Frances said:
Fox, look what I did with your divs for netscape:

http://www.francesdelrio.com/fox/

heh heh... this is too cool.. I love your that image, it's beautiful...

Thank you! But that site is old and showing its age (I haven't updated
it in a few years...) I left the transparencies out for Mozilla browsers
back then because of severe performance degradation.

Check out http://site-creations.com instead... It still "plays" better
in IE, but Mozilla is coming along (finally). Also, for a really nice
bit of dhtml, check out the HSL Color Schemer under the tools menu
(there's a link for the instructions under the color picker - one new
feature not explained in the instructions - you are able to type an HTML
RGB color in the Main color text box, and hit Enter to set a new color.)

Fox
************


<snipped>
 
R

Richard Cornford

Fox said:
Eli wrote:

window.open() is more correct...

There is no measure of relative "correctness" between the two. They are
both valid javascript syntax (examples of the CallExpression
production).
open() will attempt to call that method on the "current
object".

If any object is to be considered the "current object" it would be the
object referred to bye the - this - keyword. The resolution of an
unqualified identifier is against the scope chain and the object
referred to by - this - will not necessarily be on the scope chain
(although the global object is always on the end of the scope chain and
is also most often also the object referred to by - this -).

Given the code:-

open();

- the objects in the scope chain are examined in turn to see if they (or
one of their prototypes, if any) have a property called "open". If one
of them does then a value of the internal Reference type is returned
with the object in question assigned as its "base" object and "open"
assigned to its property name. Then the internal GetValue fucntion is
called with that Reference type as its argument and if the returned
value is an Object that implements the [[Call]] method (so a function)
then it is executed.

Because the global object is always at the end of the scope chain and
the global object is the window object, if not other object on the chain
has an "open" property then the function called is the "open" method of
the window object.

When the code:-

window.open();

- is used the initial identifier resolution against the scope chain is
for "window". in web browser the global object has a property called
"window", that is itself a reference to the global object. So the
identifier resolution returns a reference to the global object. Then the
"open" property name is looked up on that object to acquire a reference
to the 2open" method, prior to its execution.

As a result both expressions execute the same function, but the second
is fractionally slower as it involves an additional step.
I suspect IE is much more lenient about this syntactical
mistake.

There is no syntactical mistake in either expression.

There is also a document.open() as well that is very
different ( ... .)

And when a document is on the scope chain that would be significant as
it would probably be above the global object and examined before it.
Some browsers, or scripting environments
might complain if you are not more specific.

When some browsers generates functions form source code provided as text
string values for event-handling attributes in the HTML source they
provide those functions with custom scope chains, and sometimes they do
place the document on those scope chains. Because browsers may or may
not provide these custom scope chains, and when they do they may or may
not place the document on that scope chain, it is safer to use -
window.open() - in code provided as an event handling attribute in the
HTML source. In normal javascript contexts the scope chain is
sufficiently clearly specified to allow the author to understand any
consequences of using - open() - instead of - window.open() - as
without action on the part of the author there would be no issue with
using - open() - (beyond the usual consideration of whether the browser
supports an open method at all), and it would be more efficient.

Richard.
 
F

Frances Del Rio

Fox, I found many intriguing stuff in yr code.. what is this??
a href = '?design' what does the question mark do at the beginning of
this link? because in same tag you have "onclick = "return
handleClick('design')" so what does 'href=?design' do?? what does
handleClick do?? what is 'es' in yr code?? have not found a declaration
for it.. (as in 'es("content").height = 234;'

#design, #programming, etc. have a positiong of top:0; left:0;?????
it's like they're inside 'content' div, but in html code they're not
inside 'content' div.. ok, well.. great design either way.. :) Frances
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top