Solved

Avoid form Validation

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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…

912 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

18 Experts available now in Live!

Get 1:1 Help Now