Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Avoid form Validation

Posted on 1998-02-13
4
Medium Priority
?
173 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 320 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…

670 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