Solved

Avoid form Validation

Posted on 1998-02-13
4
171 Views
Last Modified: 2010-05-18
I would like  this script to work without the validation. So that when the user has finished entering the line and press return the url is launched. Like the second script that do just that but doesn't work on Internet explorer 3.The first one does.

Here is the jump script and form.(This one works on every browser)


<SCRIPT LANGUAGE="JavaScript">
<!-- JavaScript begins...
function jump (page) {
if(page.substring(0,7)!="http://")page = "http://" + page
      window.location = page;
}
// JavaScript ends -->
</SCRIPT>


<FORM NAME="URLframe">
    <TABLE BORDER="0" ALIGN="CENTER">
      <TR>
        <TD VALIGN="MIDDLE" ALIGN="CENTER" WIDTH="607"><FONT SIZE="3" COLOR="#000000" FACE="VERANDA,ARIAL,HELVETICA"><B>http://</B></FONT><INPUT TYPE="TEXT" NAME="Dest" SIZE="35" MAXLENGTH="50"></TD>
      </TR>
      <TR>
        <TD ALIGN="CENTER" WIDTH="607">
        <P><A HREF="JavaScript:jump(document.URLframe.Dest.value)"><IMG SRC="icons/gob.gif" BORDER="0" HEIGHT="20" WIDTH="60" ALT="GO Button"></A></P></TD>
      </TR>
    </TABLE></FORM>

Here is the script that work on Netscape only and perform the validation by return.

<SCRIPT LANGUAGE="JavaScript">
<!--start stealth

 function GoToURL(j) {
  window.status=('Connecting....')
 
var URLis;
 URLis = document.URLframe.Dest.value
 
   if (URLis == "" || URLis.length <= 8)
           {
     j.value = "Try Again"
      alert('\nOops!\n\nYou must enter a valid URL');
         window.status=('Missing data or Invalid. Try again?.')
           }
    else
        {
 j.value = "Connecting to: http:\\" + URLis  
 var location=("http://" + URLis);
        this.location.href = location;

window.status=('Connecting to ' + URLis + '  Please wait........');
        }
        }
 //-->
</SCRIPT>

<FORM NAME="URLframe"
    ONSUBMIT="GoToURL(document.URLframe.Dest.value);return false;">
    <INPUT TYPE="text" NAME="Dest" SIZE="12" MAXLENGTH="50"></FORM>

Thank you for your help.
0
Comment
Question by:jeffos
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Expert Comment

by:Christian_Wenz
ID: 1278227
I don't quite understand your question - why doesn't it work with IE?

And: how about commenting the validation code (putting a /* before the j.value = ... and a */ after the ...Try again?')  ?
0
 
LVL 10

Accepted Solution

by:
kollegov earned 80 total points
ID: 1278228
The second script don't work in Mie3 due to use of
window.location.href
(href not supported by MIE3)
use
window.location instead.

so it should be something like this:

function GoToURL(j) {
window.status=('Connecting....')
var URLis;
URLis = document.URLframe.Dest.value
if(URLis.indexOf("http://")!=0) URLis="http://"+URLis;
j.value = "Connecting to: " + URLis
window.location = URLis;

window.status=('Connecting to: ' + URLis + ' Please wait........');
}


0
 

Author Comment

by:jeffos
ID: 1278229
thanks a lot.
0
 

Author Comment

by:jeffos
ID: 1278230
thanks a lot.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question