Re: Re: JavaScript Help

From: Date: Sat, 26 Aug 2000 01:07:27 +0000
Subject: Re: Re: JavaScript Help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-13766@lists.php.net to get a copy of this message
At 11:16 PM 8/25/2000 +0200, Chris Hayes wrote:
From:                   Joao Prado Maia <jpm@kefta.com>
Subject:                JavaScript Help
Ok, I have a form in a page, and I want to target the results to a new window. Internet Explorer creates the little window that I want, but it doesn't show anything in there, and then creates another window (big one) with the results of the form. "blank" might mean a white page to IE. At least "about:blank" does. So better choose another name.
Just to let you know, I created a dirty and cool work-around for this problem. I'm building a get url string dynamically from javascript and using it on window.open('url_here', ...); Here goes the code: function controlSend() { var targetUrl = "http://www.booboo.com/send.php?"; var windowName = "Send"; var windowFeatures = "width=400,height=300,top=30,left=30,resizable=no,scrollbars=yes,toolbar=no,location=no,menubar=no,status=no"; if (isFormComplete()) {
    // loop goes here!
    for (var i = 0; i < document.raf_form.elements.length; i++) {
      if ((document.raf_form.elements[i].type == "checkbox") && (document.raf_form.elements[i].value != "")) {
        targetUrl += "&" + document.raf_form.elements[i].name + "=on";
      } else if ((document.raf_form.elements[i].type == "text") || (document.raf_form.elements[i].type == "textarea")) {
        targetUrl += "&" + document.raf_form.elements[i].name + "=" + escape(document.raf_form.elements[i].value);
      }
    }
    windowRaf = window.open(targetUrl, windowName, windowFeatures);
} } Anyway, it works like a charm for Internet Explorer now, as it should. The problem is that a <TEXTAREA> tag holds a lot of data, and there is a limit on the get url somehow. I'm not going to use it on my real application, but it solves a problem for my personal site that didn't have any big text fields, it was just a polling script calling a new window. It is going to work for this application so I'm happy :) The contents of the <TEXTAREA> field get truncated to 1280 bytes or something like that, so maybe I can just use a javascript validation to check if there is too much data on that field. I'm not sure if my boss is going to like it, but oh well. By the way, if you are trying to use the above example, don't use a TARGET attribute on your <FORM> tag, and put the codelike this : <INPUT TYPE=BUTTON NAME="Blah" onClick="controlSend();"> Best Regards, Joao -- Joao Prado Maia Web Developer Kefta.com, Inc

« previous php.general (#13766) next »