| phpMyEdit - Viewing Bug Advanced Details | [ Go Back ] | ||||
|
|
|||||
| ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
| 678 | core / general | block | always | 2010-05-12 17:33 | 2010-05-12 17:33 |
|
|
|||||
| Reporter: | the_max@libero.it | Platform: | PHP 5.2.5 + MySQL 5.0.45 | ||
| Assigned To: | OS: | Windows XP | |||
| Priority: | normal | Version: | SP3 | ||
| Status: | new | Product Version: | 5.7.1 (stable) | ||
| Product Build: | v 1.204 2007-09-16 12:57:07 | Resolution: | open | ||
| Projection: | none | Duplicate ID: | |||
| ETA: | none | ||||
|
|
|||||
| 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. |