codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  javascript to validate an entry is in URL format.  dnew at 13:43 on Monday, February 14, 2005
 

Hello
I was wondering if anyone could possibly help, im looking to create a javascript function that will validate whether or not a user entry into a text element of form is actually in the correct URL format.
This is my form code at the moment.

<input type="text" size="70" id="inurl" name="inurl" value="">
<input type="button" value="Request URL" id="suburl" onClick="document.Assignment1.updateURL(document.getElementById('inurl').value)">
</form>

Thanks
Mark

<Added>

Hello
I was wondering if anyone could possibly help, im looking to create a javascript function that will validate whether or not a user entry into a text element of form is actually in the correct URL format.
This is my form code at the moment.

<input type="text" size="70" id="inurl" name="inurl" value="">
<input type="button" value="Request URL" id="suburl" onClick="document.Assignment1.updateURL(document.getElementById('inurl').value)">
</form>

Thanks
Mark

<Added>

Hello
I was wondering if anyone could possibly help, im looking to create a javascript function that will validate whether or not a user entry into a text element of form is actually in the correct URL format.
This is my form code at the moment.

<input type="text" size="70" id="inurl" name="inurl" value="">
<input type="button" value="Request URL" id="suburl" onClick="document.Assignment1.updateURL(document.getElementById('inurl').value)">
</form>

Thanks
Dave

<Added>

Hello
I was wondering if anyone could possibly help, im looking to create a javascript function that will validate whether or not a user entry into a text element of form is actually in the correct URL format.
This is my form code at the moment.

<input type="text" size="70" id="inurl" name="inurl" value="">
<input type="button" value="Request URL" id="suburl" onClick="document.Assignment1.updateURL(document.getElementById('inurl').value)">
</form>

Thanks
Dave

  Re: javascript to validate an entry is in URL format.  websandy at 06:40 on Tuesday, February 15, 2005
 

Call this function on the event where you want check for validation and should work without any hindrance

function validateURL()
{
lengthValue = Trim(document.getElementById(txtURL).value);
lengthValue = lengthValue.length;
if(lengthValue != 0)
{
var j = new RegExp();
j.compile("^[A-Za-z]+://[A-Za-z0-9-]+\.[A-Za-z0-9]+");
lengthValue = Trim(document.getElementById('txtWeb').value);
if (!j.test(lengthValue))
{
alert(Please enter valid URL.");
return false;
}
}



  Re: javascript to validate an entry is in URL format.  websandy at 06:42 on Tuesday, February 15, 2005
 

Call this function on the event where you want check for validation and should work without any hindrance

function validateURL()
{
lengthValue = Trim(document.getElementById(txtURL).value);
lengthValue = lengthValue.length;
if(lengthValue != 0)
{
var j = new RegExp();
j.compile("^[A-Za-z]+://[A-Za-z0-9-]+\.[A-Za-z0-9]+");
lengthValue = Trim(document.getElementById('txtWeb').value);
if (!j.test(lengthValue))
{
alert(Please enter valid URL.");
return false;
}
}



  Re: javascript to validate an entry is in URL format.  websandy at 06:42 on Tuesday, February 15, 2005
 

Call this function on the event where you want check for validation and should work without any hindrance

function validateURL()
{
lengthValue = Trim(document.getElementById(txtURL).value);
lengthValue = lengthValue.length;
if(lengthValue != 0)
{
var j = new RegExp();
j.compile("^[A-Za-z]+://[A-Za-z0-9-]+\.[A-Za-z0-9]+");
lengthValue = Trim(document.getElementById('txtWeb').value);
if (!j.test(lengthValue))
{
alert(Please enter valid URL.");
return false;
}
}



  Re: javascript to validate an entry is in URL format.  websandy at 06:42 on Tuesday, February 15, 2005
 

Call this function on the event where you want check for validation and should work without any hindrance

function validateURL()
{
lengthValue = Trim(document.getElementById(txtURL).value);
lengthValue = lengthValue.length;
if(lengthValue != 0)
{
var j = new RegExp();
j.compile("^[A-Za-z]+://[A-Za-z0-9-]+\.[A-Za-z0-9]+");
lengthValue = Trim(document.getElementById('txtWeb').value);
if (!j.test(lengthValue))
{
alert(Please enter valid URL.");
return false;
}
}



  Re: javascript to validate an entry is in URL format.  websandy at 06:42 on Tuesday, February 15, 2005
 

Call this function on the event where you want check for validation and should work without any hindrance

function validateURL()
{
lengthValue = Trim(document.getElementById(txtURL).value);
lengthValue = lengthValue.length;
if(lengthValue != 0)
{
var j = new RegExp();
j.compile("^[A-Za-z]+://[A-Za-z0-9-]+\.[A-Za-z0-9]+");
lengthValue = Trim(document.getElementById('txtWeb').value);
if (!j.test(lengthValue))
{
alert(Please enter valid URL.");
return false;
}
}



  Re: javascript to validate an entry is in URL format.  websandy at 06:43 on Tuesday, February 15, 2005
 

Call this function on the event where you want check for validation and should work without any hindrance

function validateURL()
{
lengthValue = Trim(document.getElementById(txtURL).value);
lengthValue = lengthValue.length;
if(lengthValue != 0)
{
var j = new RegExp();
j.compile("^[A-Za-z]+://[A-Za-z0-9-]+\.[A-Za-z0-9]+");
lengthValue = Trim(document.getElementById('txtWeb').value);
if (!j.test(lengthValue))
{
alert(Please enter valid URL.");
return false;
}
}



  Re: javascript to validate an entry is in URL format.  websandy at 06:43 on Tuesday, February 15, 2005
 

Call this function on the event where you want check for validation and should work without any hindrance

function validateURL()
{
lengthValue = Trim(document.getElementById(txtURL).value);
lengthValue = lengthValue.length;
if(lengthValue != 0)
{
var j = new RegExp();
j.compile("^[A-Za-z]+://[A-Za-z0-9-]+\.[A-Za-z0-9]+");
lengthValue = Trim(document.getElementById('txtWeb').value);
if (!j.test(lengthValue))
{
alert(Please enter valid URL.");
return false;
}
}










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Data
•  Problem with the Insert at a desired position in a FARPOINT GRID
•  Re: dynamic crystal report generation
•  Re: plz Help on this!
•  Re: Session variable
•  Re: Query on onLoad
•  Re: Saving a Picture or Image contained within a Picturebox into Windows Registry
•  display different images(for image button) in template column for each row
•  Re: crystal report - Logon failed.


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005