BUG-14953 WEBENTRY - ProcessMaker does not check if Javascript is running.

When JS is not enabled in the browser, the JS validations dosen`t work, so you can submit the form even if there are empty requiered fields.

A validation <noscript> was added in the HTML code, to validate if the browser has or not JS enable.

If there is not JS enable, the validation is make in the php code to.
This commit is contained in:
jennylee
2014-08-28 16:57:54 -04:00
parent ab41c74d4b
commit bbf0328d9e
3 changed files with 39 additions and 3 deletions

View File

@@ -72,9 +72,15 @@
$previouspage = $_POST['previous_step']['PAGE'];
$html .= '</td></tr><tr><td align="center">';
$html .= '<input type="button" value="Back" class="module_app_button___gray" onclick="javascript:history.back()">';
$html .= '<input type="button" value="Continue" class="module_app_button___gray" onclick="javascript:location.href=\''.$netxpage.'\'">';
if($netxpage == ""){
$html .= '<a href='.$previouspage.'>';
$html .= '<input type="button" value="Back" class="module_app_button___gray" />';
$html .= '</a>';
} else{
$html .= '<input type="button" value="Back" class="module_app_button___gray" onclick="javascript:history.back()">';
$html .= '<input type="button" value="Continue" class="module_app_button___gray" onclick="javascript:location.href=\''.$netxpage.'\'">';
}
echo '<div class="grid" style="width:'.$width_content.'">
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>

View File

@@ -137,6 +137,30 @@ try {
* you can change it or redirect to another page
* i.e. G::header("Location: http://www.processmaker.com");
*/
$_POST['__notValidateThisFields__'] = (isset( $_POST['__notValidateThisFields__'] ) && $_POST['__notValidateThisFields__'] != '') ? $_POST['__notValidateThisFields__'] : $_POST['DynaformRequiredFields'];
if ($missing_req_values = $oForm->validateRequiredFields( $_POST['form'], Bootstrap::json_decode( stripslashes( $_POST['__notValidateThisFields__'] ) ) )) {
$fieldsRequired = Bootstrap::json_decode(str_replace(array("%27", "%39"), array("\"", "'"), $_POST["DynaformRequiredFields"]));
foreach ($fieldsRequired as $key1 => $value1) {
foreach ($missing_req_values as $key2 => $value2) {
if ($value1->name == $value2) {
$missing_req_values[$key2] = $value1->label;
}
}
}
$_POST['next_step']['PAGE'] = "";
$_POST['previous_step']['PAGE'] = $_SERVER['HTTP_REFERER'];
$_POST['req_val'] = $missing_req_values;
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'cases/missRequiredFields' );
G::RenderPage( 'publish', 'blank' );
exit( 0 );
}
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent("xmlform", "xmlform", "login/showInfo", "", $aMessage);
G::RenderPage("publish", "blank");