Solved

Avoid form Validation

Posted on 1998-02-13
4
166 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
  • 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now