mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
FEATURE: Added Inequality filters to the custom rules. To Allow Numeric fields to be processed by > < statements
This commit is contained in:
parent
7ca3371fa1
commit
c34a2af447
@ -379,9 +379,25 @@ class UserDefinedForm_Controller extends Page_Controller {
|
||||
$expression = ($checkboxField) ? '$(this).attr("checked")' : '$(this).val() == "'. $dependency['Value'] .'"';
|
||||
|
||||
break;
|
||||
case 'ValueLessThan':
|
||||
$expression = '$(this).val() < parseFloat("'. $dependency['Value'] .'")';
|
||||
|
||||
break;
|
||||
case 'ValueLessThanEqual':
|
||||
$expression = '$(this).val() <= parseFloat("'. $dependency['Value'] .'")';
|
||||
|
||||
break;
|
||||
case 'ValueGreaterThan':
|
||||
$expression = '$(this).val() > parseFloat("'. $dependency['Value'] .'")';
|
||||
|
||||
break;
|
||||
case 'ValueGreaterThanEqual':
|
||||
$expression = '$(this).val() >= parseFloat("'. $dependency['Value'] .'")';
|
||||
|
||||
break;
|
||||
default:
|
||||
$expression = ($checkboxField) ? '!($(this).attr("checked"))' : '$(this).val() != "'. $dependency['Value'] .'"';
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
// put it all together
|
||||
|
@ -46,6 +46,7 @@ class EditableMultipleOptionField extends EditableFormField {
|
||||
$option->publish($fromStage, $toStage, $createNewVersion);
|
||||
}
|
||||
}
|
||||
|
||||
parent::publish($fromStage, $toStage, $createNewVersion);
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@
|
||||
*/
|
||||
$(".customRules .conditionOption").livequery('change', function(){
|
||||
var valueInput = $(this).siblings(".ruleValue");
|
||||
if($(this).val() == "ValueNot" || $(this).val() == "HasValue") {
|
||||
if($(this).val() != "" && $(this).val() != "IsBlank" && $(this).val() != "IsNotBlank") {
|
||||
valueInput.removeClass("hidden");
|
||||
}
|
||||
else {
|
||||
|
@ -106,6 +106,10 @@
|
||||
<option value="IsNotBlank"><% _t('NOTBLANK', 'Not Blank') %></option>
|
||||
<option value="HasValue"><% _t('VALUE', 'Value') %></option>
|
||||
<option value="ValueNot"><% _t('NOTVALUE', 'Not Value') %></option>
|
||||
<option value="ValueLessThan"><% _t('LESSTHAN', 'Value Less Than') %></option>
|
||||
<option value="ValueLessThanEqual"><% _t('LESSTHANEQUAL', 'Value Less Than Or Equal') %></option>
|
||||
<option value="ValueGreaterThan"><% _t('GREATERTHAN', 'Value Greater Than') %></option>
|
||||
<option value="ValueGreaterThanEqual"><% _t('GREATERTHANEQUAL', 'Value Greater Than Or Equal') %></option>
|
||||
</select>
|
||||
|
||||
<input type="text" class="ruleValue hidden customRuleField" name="{$FieldName}[CustomRules][Value]" />
|
||||
|
@ -13,11 +13,14 @@
|
||||
|
||||
<label><% _t('IS', 'Is') %></label>
|
||||
<select class="conditionOption customRuleField" name="{$FieldName}[CustomRules][$Pos][ConditionOption]">
|
||||
<option value=""></option>
|
||||
<option value="IsBlank" <% if ConditionOption = IsBlank %>selected="selected"<% end_if %>><% _t('BLANK', 'Blank') %></option>
|
||||
<option value="IsNotBlank" <% if ConditionOption = IsNotBlank %>selected="selected"<% end_if %>><% _t('NOTBLANK', 'Not Blank') %></option>
|
||||
<option value="HasValue" <% if ConditionOption = HasValue %>selected="selected"<% end_if %>><% _t('VALUE', 'Value') %></option>
|
||||
<option value="ValueNot" <% if ConditionOption = ValueNot %>selected="selected"<% end_if %>><% _t('NOTVALUE', 'Not Value') %></option>
|
||||
<option value="ValueLessThan" <% if ConditionOption = ValueLessThan %>selected="selected"<% end_if %>><% _t('LESSTHAN', 'Value Less Than') %></option>
|
||||
<option value="ValueLessThanEqual" <% if ConditionOption = ValueLessThanEqual %>selected="selected"<% end_if %>><% _t('LESSTHANEQUAL', 'Value Less Than Or Equal') %></option>
|
||||
<option value="ValueGreaterThan" <% if ConditionOption = ValueGreaterThan %>selected="selected"<% end_if %>><% _t('GREATERTHAN', 'Value Greater Than') %></option>
|
||||
<option value="ValueGreaterThanEqual" <% if ConditionOption = ValueGreaterThanEqual %>selected="selected"<% end_if %>><% _t('GREATERTHANEQUAL', 'Value Greater Than Or Equal') %></option>
|
||||
</select>
|
||||
|
||||
<input type="text" class="ruleValue <% if Value %><% else %>hidden<% end_if %> customRuleField" name="{$FieldName}[CustomRules][$Pos][Value]" value="$Value" />
|
||||
|
Loading…
Reference in New Issue
Block a user