homepage Welcome to WebmasterWorld Guest from 54.198.157.6
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
New Window for Forms - differnt than most...
Equivity




msg:1477800
 5:40 pm on May 18, 2003 (gmt 0)

I am trying to get the following form to open in a new window that I can define the size and now have any toolbars. I have searched the net for hours and can't seem to find one that fits my situation. Here is the code.

<form name="DomainSearch" method="GET" action="https://URL_of_the_Page_I_want_to_process_to" style="float: left">
<input type="hidden" name="siteid" value="23319">
<input name="DomainName" size="10"><input type=image src="images/but_m.jpg" name=Submit value=Search width="37" height="22" style="padding-top:2"></form>

Any help would be greatly appreicated.

 

macrost




msg:1477801
 7:01 pm on May 18, 2003 (gmt 0)

If I believe I'm right, then in the new window, you'll have to use some javascript in an onload in the body to define your window size, and accessories.
Mac
[edit]BTW, Welcome to WebMasterWorld![/edit]

ShawnR




msg:1477802
 12:01 am on May 19, 2003 (gmt 0)

Hi Equivity & welcome to WebmasterWorld

Rather than have the javascript fire onload, rather call it from the page which opens your form. i.e. put your form in a new html document complete with <html>, <head>, <body> tags, etc. Then make it open as a pop-up. Just do a site search for 'popup'; there are many posts showing how do do that. The 'site search' button is near the top of this page.

Shawn

Equivity




msg:1477803
 12:28 am on May 19, 2003 (gmt 0)

Normally that would work, but the URL I am going to is a third-party site so I do not have access to there HTML. See my problem.

ShawnR




msg:1477804
 12:38 am on May 19, 2003 (gmt 0)

Not sure I understand you correctly... You have a form with an 'action' https://URL_of_the_Page_I_want_to_process_to", and you want want https://URL_of_the_Page_I_want_to_process_to (i.e. the results) to open up as a pop-up? Yes? At any rate, you don't need to make any changes to the html page that will be pop'ed up. All the code should go in the calling page.

Equivity




msg:1477805
 12:53 am on May 19, 2003 (gmt 0)

This is a search form (i.e. domain name search). I have a reseller for then, when someone click the search button it processes the name they are searching for through there site and return the results on there site (using my userid number) What I want to do is when you click on the search button it open a new screen pulling there page results. I do not want the toolbars or menu bars to show up and I want to define the new window size.

Does all that make sense, :-) I hope so, sometimes I can make things hard to understand.

aspr1n




msg:1477806
 1:26 am on May 19, 2003 (gmt 0)

hmmm interesting problem, I see what you mean.

The way I would handle it would be to call a window.open command that opens a local page in which 'onload' makes the post request for you...


<form name="form">
<input type=submit name="whatever" value="search">
</form>

function submit() {
document.form.action="URL_of_the_Page_I_want_to_process_to";
document.form.target="targetName";
document.form.submit();
return;
}

asp

Equivity




msg:1477807
 1:37 am on May 19, 2003 (gmt 0)

I am very new to this part of Jave/HTML, could you break it down a little easier for me, so I know exactly what I would need to do and how to do it, Thanks so much!

ShawnR




msg:1477808
 3:26 am on May 19, 2003 (gmt 0)

Another way is to have your 'submit' button an <a> tag instead of an <input>. Have it do something like: <a href="javascript:my_submit_function()">

Where you define my_submit_function something like this:

function my_submit_function () {
____var domain_to_find = document['DomainSearch'].elements['DomainName'].value;
____var my_uri = "https://URL_of_the_Page_I_want_to_process_to";
____my_uri += "?siteid=23319&DomainName=" + domain_to_find;
____window.open(my_uri,'a_name_for_my_window','menubar=no,toolbar=no,status=no,width=500,height=500,resizable=yes,scrollbars=yes');
}

Shawn

aspr1n




msg:1477809
 10:26 am on May 19, 2003 (gmt 0)

nah wouldn't work ShawnR - you've got to remember that the POST request needs to *return* the information into the popup.

Equivity, all you need to do is attached the js function I gave you to the body of your popup page, to ensure it fires on load, and submits the form for you.

asp

ShawnR




msg:1477810
 1:16 pm on May 19, 2003 (gmt 0)

Good point. But Equivity needs a GET, not a POST, if I read msg#1 correctly, so it will work.

Not saying that your suggestion won't work as well, mind. (Although it does need some more code, because it needs to get the user input from somewhere. That 'somewhere' is the form on the origninal calling page. So you need to pass it in the calling url and then, in the receiving page, extract it and insert the values into your new form, before submitting the form using the onload event.)

With me?

Once you put in that additional code, it will work, but I just thought I'd provide an additional alternative which doesn't need the second html page and doesn't need the extra code.

Shawn

Equivity




msg:1477811
 2:06 pm on May 19, 2003 (gmt 0)

I am not sure which one would be best to use, or I how I would ever write the code any help with that would be AWESOME.

aspr1n




msg:1477812
 2:31 pm on May 19, 2003 (gmt 0)

Yeah Shawn - you're quite right sorry about that.

Equivity go with Shawn's suggestion - that's a much better method.

asp

Equivity




msg:1477813
 2:54 pm on May 19, 2003 (gmt 0)

Ok - cool.

Now I understand that Shawns suggestion would go before the <head> in my page. Now my next thing I am using a graphic as the "button" to click, how would that code change to include what Shawn suggested, This is what is is currently:

<input type=image src="images/but_m.jpg" name=Submit value=Search width="37" height="22" style="padding-top:2">

ShawnR




msg:1477814
 3:08 pm on May 19, 2003 (gmt 0)

Don't put it befor the <head>, put it before the end of the <head>. i.e. somewhere between <head> and </head>.

i.e.

<html>
<head>
:
:
<script type="text/javascript">
function my_submit_function () {
.... etc
}
</script>
</head>

Instead of your <input> tag, do something like:

<a href="javascript:my_submit_function()"> <img src="images/but_m.jpg" alt="search" width="37" height="22" style="padding-top:2"></a>

Shawn

Equivity




msg:1477815
 3:44 pm on May 19, 2003 (gmt 0)

PERFECT PERFECT PERFECT!

AWESOME IT WORKS GREAT!

THANK YOU!

One question:

Although it works do I still need the following in the ,form> tag?

action="https://www.registerapi.com/rapi/style1/Registration/Step_01/CheckDomain.asp" style="float: left">
<input type="hidden" name="siteid" value="23319">

aspr1n




msg:1477816
 4:15 pm on May 19, 2003 (gmt 0)

Equivity,

In the nicest possible way, we're here to help - not do your homework for you. Try it and see what happens.

asp

Equivity




msg:1477817
 4:43 pm on May 19, 2003 (gmt 0)

You are right, sometime I think it woulr be easier to just ask and get an answer than to trial and error and learn something new. :-)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved