Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, November 12, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Bug list  »  Bug #678

Viewing Bug Advanced Details [ Jump to Bugnotes ] [ Bug History ] [ Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000678 core / general block always 2010-05-12 17:33 2010-05-12 17:33
 
Reporter the_max@libero.it View Status public  
Assigned To
Priority normal Resolution open Platform PHP 5.2.5 + MySQL 5.0.45
Status new Duplicate ID OS Windows XP
Projection none Version SP3
ETA none Product Version 5.7.1 (stable)
  Product Build v 1.204 2007-09-16 12:57:07
  Votes 1
 
Summary JavaScript regular expression is not working! Wrong JS code cause no data validation.
Description JavaScript regular expression is not working! Wrong JS code cause no data validation in the function PME_js_form_control.
I have find and fixed PHP lines code (see solution)
Steps To Reproduce The following code produce invalid JS code in HTML page :

$opts['fdd']['Utente'] = array(
'name' => 'Utente',
'help' => 'Nome utente usato per il login (account di accesso)',
'select' => 'T',
'js' => array('required' => true),
'maxlen' => 40,
'sort' => true
);
$opts['fdd']['EMail'] = array(
'name' => 'EMail',
'help' => 'Indirizzo e-mail (nel formato : stringa@nomedominio.estensione)',
'js' => array('regexp' => '.+@.+\\.[a-z]+', 'hint' => 'Inserire un indirizzo email valido!'),
'select' => 'T',
'maxlen' => 40,
'sort' => true
);
// Now important call to phpMyEdit
require_once('../phpMyEdit.class.php');
$myedit = new phpMyEdit($opts);
Additional Information / Solution The Solution is to replace the following code (after modification js required fields and js regexp works OK) :

if (isset($this->fdd[$k]['js']['regexp'])) {
$condition .= (strlen($condition) > 0 ? ' || ' : '');
$condition .= sprintf('!(%s.test('.$this->js['prefix'].'trim(theForm.%s.value)))',
$this->fdd[$k]['js']['regexp'], $this->cgi['prefix']['data'].$this->fds[$k]);
}

With this code :

if (isset($this->fdd[$k]['js']['regexp'])) {
// Build javascript regular expression condition!
// JS line code example : if (!(theForm.PME_data_EMail.value.match(new RegExp(".+@.+\.[a-z]+")))) {

$condition .= (strlen($condition) > 0 ? ' || ' : '');
$condition .= sprintf('!(theForm.%s.value.match(new RegExp("%s")))', $this->cgi['prefix']['data'].$this->fds[$k], $this->fdd[$k]['js']['regexp']);
}
Attached Files

There are no notes attached to this bug.

Bug History
Date Modified Username Field Change
2010-05-12 17:33 the_max@libero.it New Bug

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy