Hello everyone
I've found a fault in the HTML-Parsing in the function "check_for_valid_fields" (Found in class.tx_wecservant_pi1.php on line 1573)
This function check fpr valid fields and generate a list with the errors. The Problem is that the list look like that:
<li>Error #1, <br/>
<li>Error #2, <br/>
<li>Error #3, <br/>
But it should like like this:
<ul>
<li>Error #1</li>
<li>Error #2</li>
<li>Error #3</li>
</ul>
I changed the function "check_for_valid_fields" in "class.tx_wecservant_pi1.php" on line 1573
function check_for_valid_fields() {
$error = "";
if (is_array($this->config['required_formfields']) && count($this->config['required_formfields'])>0) {
$whichOne = 0;
foreach ($this->config['required_formfields'] AS $req_field) {
if (empty($this->postvars[$req_field])) {
// Comment out if ($whichOne++ > 0)
// Comment out $error .= ", ";
$error .= '<li> "'.ucfirst($this->pi_getLL('form_'.$req_field.'_label')).'" '.$this->pi_getLL('form_required_blank')."</li>n";
}
}
// Comment out if ($whichOne > 0) $error .= ".<br>";
}
// check if optional one is required
foreach ($this->postvars as $fieldName => $fieldValue) {
$lastCh = substr($fieldName,strlen($fieldName)-1,1);
if ($lastCh == '+') { // required marker
$shortFieldName = substr($fieldName,0,strlen($fieldName)-1);
$altFieldValue = 0;
if ($this->postvars[$shortFieldName]) {
$altFieldValue = $this->postvars[$shortFieldName];
}
if (!$altFieldValue && (!strlen($fieldValue) || empty($fieldValue))) {
$fieldName = substr($fieldName,0,strlen($fieldName)-1);
$fieldName = strtr($fieldName,'_',' ');
$error .= '<li> "'.ucfirst($fieldName).'" '.$this->pi_getLL('form_required_blank')."</li>n";
}
}
}
if (!empty($this->postvars['email'])) {
if (t3lib_div::validEmail($this->postvars['email']) == false) {
$error .= '<li>"'.$this->pi_getLL('form_email_label').'" ('.$this->pi_getLL('form_invalid_field').")</li>n";
}
}
if (strlen($error) == 0)
return 0;
else
return "<ul>". $error ."</ul>";
}
Like that the list is parsed properly.
Greetings from Switzerland
Jonathan Uhlmann
I've found a fault in the HTML-Parsing in the function "check_for_valid_fields" (Found in class.tx_wecservant_pi1.php on line 1573)
This function check fpr valid fields and generate a list with the errors. The Problem is that the list look like that:
<li>Error #1, <br/>
<li>Error #2, <br/>
<li>Error #3, <br/>
But it should like like this:
<ul>
<li>Error #1</li>
<li>Error #2</li>
<li>Error #3</li>
</ul>
I changed the function "check_for_valid_fields" in "class.tx_wecservant_pi1.php" on line 1573
function check_for_valid_fields() {
$error = "";
if (is_array($this->config['required_formfields']) && count($this->config['required_formfields'])>0) {
$whichOne = 0;
foreach ($this->config['required_formfields'] AS $req_field) {
if (empty($this->postvars[$req_field])) {
// Comment out if ($whichOne++ > 0)
// Comment out $error .= ", ";
$error .= '<li> "'.ucfirst($this->pi_getLL('form_'.$req_field.'_label')).'" '.$this->pi_getLL('form_required_blank')."</li>n";
}
}
// Comment out if ($whichOne > 0) $error .= ".<br>";
}
// check if optional one is required
foreach ($this->postvars as $fieldName => $fieldValue) {
$lastCh = substr($fieldName,strlen($fieldName)-1,1);
if ($lastCh == '+') { // required marker
$shortFieldName = substr($fieldName,0,strlen($fieldName)-1);
$altFieldValue = 0;
if ($this->postvars[$shortFieldName]) {
$altFieldValue = $this->postvars[$shortFieldName];
}
if (!$altFieldValue && (!strlen($fieldValue) || empty($fieldValue))) {
$fieldName = substr($fieldName,0,strlen($fieldName)-1);
$fieldName = strtr($fieldName,'_',' ');
$error .= '<li> "'.ucfirst($fieldName).'" '.$this->pi_getLL('form_required_blank')."</li>n";
}
}
}
if (!empty($this->postvars['email'])) {
if (t3lib_div::validEmail($this->postvars['email']) == false) {
$error .= '<li>"'.$this->pi_getLL('form_email_label').'" ('.$this->pi_getLL('form_invalid_field').")</li>n";
}
}
if (strlen($error) == 0)
return 0;
else
return "<ul>". $error ."</ul>";
}
Like that the list is parsed properly.
Greetings from Switzerland
Jonathan Uhlmann



aim