[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    RegExp Issue
From:       Andreas Pour <pour () kde ! com>
Date:       2001-09-19 2:12:28
[Download RAW message or body]

Hiya,

I have been getting a lot of reports from users with Konqueror 2.2 that
the top search box on apps.kde.com does not work.  From the description
of the error messages, the line causing problems is the RegExp "test"
line.  However, the line works fine on my KDE 2.2, so I can't figure out
what's wrong.  I do note I did not get this report before 2.2, so maybe
something that changed in the meantime is causing the problem (perhaps
the switch to pcre?).

Another problem I noticed is that though the RegExp works on my 2.2, the
validator function is always called twice.  A sample test case is
attached -- I get the popup twice when entering valid text (like "aaa").

Ciao,

Dre
["testcase.html" (text/html)]

<HTML>
<BODY>
<FORM NAME="search_form"  METHOD="POST" ACTION="mailto:test@kde.org" ONSUBMIT="return \
searchform_Validator(this)"> <INPUT NAME="query" VALUE="" TYPE="text" MAXLENGTH="32" \
SIZE="12"> </FORM>
<SCRIPT TYPE="text/javascript" LANGUAGE="javascript">
<!-- Hide from old browsers
function searchform_Validator(f)
{
  alert('I am here, query is:\n'+f.query.value);
  if ((f.query.value.length  > 32) || (f.query.value.length < 1))
  {
    alert("The query must consist of at least one and not more than 32 letters");
    f.query.focus();
    return(false);
  }
  if (window.RegExp)
  {
    var reg = new RegExp("[-A-Za-z0-9_. !]{1,32}","g");
    if (!reg.test(f.query.value))
    {
      alert("The query must consist of only letters, numbers and the characters '-', \
'.', ' ', '!' and '_'");  f.query.focus();
      return(false);
    }
  }
  return true;
}
//-->
</SCRIPT>
</BODY>
</HTML>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic