Jump to content

help please pretty please going insane here


mackevin

Recommended Posts

I keep getting this message:

 

Not a string! (only A-Z, a-z, . -)

 

Do I find this string in the file below Im not a javascript person, I really need help please

 

function is_empty(id)

{

if (document.getElementById(id).value == "")

{

return true;

}

else

return false;

}

 

function is_numeric(str)

{

return !isNaN(str);

}

 

function is_alpha(alphane)

{

var numaric = alphane;

for(var j=0; j<numaric.length; j++)

{

  var alphaa = numaric.charAt(j);

  var hh = alphaa.charCodeAt(0);

  if(  ((hh > 39 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123)) || hh == 32)

  {

  }

  else

  {

return false;

  }

}

return true;

 

}

 

function popup(URL,head,w,h) {

day = new Date();

id = day.getTime();

a = eval("page" + id + " = window.open(URL, '" + head + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+w+",height="+h+",left = 20,top = 20');");

if (a.opener == null) a.opener = self;

}

 

function valid_email(str) {

 

var at="@"

var dot="."

var lat=str.indexOf(at)

var lstr=str.length

var ldot=str.indexOf(dot)

if (str.indexOf(at)==-1){

  alert("Invalid E-mail ID")

  return false

}

 

if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

  alert("Invalid E-mail ID")

  return false

}

 

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

    alert("Invalid E-mail ID")

    return false

}

 

if (str.indexOf(at,(lat+1))!=-1){

    alert("Invalid E-mail ID")

    return false

}

 

if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

    alert("Invalid E-mail ID")

    return false

}

 

if (str.indexOf(dot,(lat+2))==-1){

    alert("Invalid E-mail ID")

    return false

}

 

if (str.indexOf(" ")!=-1){

    alert("Invalid E-mail ID")

    return false

}

 

return true

}

 

function submitform(theForm, page)

{

var getStr = page + "?";

var num = theForm.length;

var theNum = num;

 

for (var i = 0; i < num; i++)

{

var el = theForm.elements;

var elname = el.name;

var elvalue = el.value;

if (elname == "")

{

theNum--;

}

}

 

for (var i = 0; i < num; i++)

{

var el = theForm.elements;

var elname = el.name;

var elvalue = el.value;

 

if (elname != "")

{

getStr += elname + "=" + elvalue;

if (i != theNum-2)

getStr += "&";

}

}

window.location = getStr;

}

 

var statusmsg="";

 

function hidestatus()

{

window.status=statusmsg

return true

}

 

function validateform(theForm)

{

var num = theForm.length;

for (var i = 0; i < num; i++)

{

var el = theForm.elements;

var elname = el.name;

if (elname != "")

{

if (is_empty(elname) && elname != "listref" && elname != "js1" && elname != "js2" && elname != "js6" && elname != "js5" && elname != "js4" && elname != "js3" && elname != "listaddsaltext" && elname != "listbossname" && elname != "listbossdesc" && elname != "listwebaddress")

{

alert("Form not complete!");

el.focus();

return false;

}

}

}

 

for (var i = 0; i < num; i++)

{

var el = theForm.elements;

var elname = el.name;

var eltype = el.type;

 

if(eltype=="text"){

if (elname != "listemailaddress" && elname != "listpricemin" && elname != "listpricemax")

{

if (!is_alphanumeric(elname))

{

alert(elname);

el.focus();

return false;

}

}

else if (elname == "listemailaddress")

{

if(!valid_email(el.value)){

alert("Not a valid email address!");

el.focus();

return false;

}

}

else

{

if (!is_numeric(el.value))

{

alert("Not a valid number!");

el.focus();

return false;

}

}

}

}

return true;

}

 

function validatepform(theForm)

{

var num = theForm.length;

for (var i = 0; i < num; i++)

{

var el = theForm.elements;

var elname = el.name;

if (elname != "")

{

if (is_empty(elname) && (elname != "sektel") && (elname != "sekcell") && elname != "tc" && elname != "ref")

{

el.focus();

alert("Form not complete!");

return false;

}

}

}

for (var i = 0; i < num; i++)

{

var el = theForm.elements;

var elname = el.name;

var eltype = el.type;

if(eltype=="text")

{

if (elname != "" && elname != "tc" && elname != "ref"){

if (!is_alphanumeric(elname))

{

el.focus();

return false;

}

}

}

}

var obj1 = document.getElementById("sektel");

var obj2 = document.getElementById("sekcell");

if (((obj1.value == "") && (obj2.value == "")) == true)

{

alert("Enter atleast one contact number!");

obj1.focus();

return false;

}

return true;

}

 

 

function checkChars(initval, area, label)

{

var obj = document.getElementById(area);

 

if (obj.length > initval)

obj.value = obj.value.substring(0, initval);

else

{

div = document.getElementById(label);

var dif = initval - obj.value.length;

div.innerHTML = "<b>" + dif + "</b> Characters Left";

}

}

 

function del(title, path)

{

if ( window.confirm("Are you sure you want to delete: " + title) )

{

window.location = path;

}

}

 

function ren(title, path)

{

if ( window.confirm("Are you sure you want to renew: " + title) )

{

window.location = path;

}

}

 

function dela(ref,appid,title)

{

if ( window.confirm("Are you sure you want to decline: " + title) )

{

window.location = "main.php?usr=rec&lev=acc&con=actiona&ref="+ref+"&appid="+appid;

 

}

}

 

function delrange(tc, hm, path)

{

var thestr = '';

var sel = 0;

for (var i = 1; i <= hm; i++)

{

obj = document.getElementById(tc+i);

if (obj.checked == true){

thestr = thestr + obj.value;

if (i < hm)

thestr += ":";

sel++;

}

}

var askstr = 'Are you sure you want to delete these ' + sel + ' items?';

if ( window.confirm(askstr) )

{

window.location = path +"&dr="+thestr;

}

 

}

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.