UiBibz::Ui::Core::Forms::Numbers::FormulaField
By default, the second input name will take the first input name + "_formula".
If there is an error in your formula, a warning will be diplay with an explain through attribute title in addon warning.
# by variable
ui_formula_field name, options, html_options
# or by block
ui_formula_field options, html_options do
name
end
ui_formula_field "value", {}, { placeholder: "Type your formula..."}
<div class="input-group ui_formula_field">
<input type="text" name="value" id="value" value="" placeholder="Type your formula..." class="ui_formula_field_input form-control">
<span class="ui_formula_field_sign input-group-addon">=</span>
<input type="text" name="value_formula" id="value_formula" value="" readonly="readonly" class="ui_formula_field_result form-control">
<span class="ui_formula_field_alert input-group-addon" data-toggle="tooltip">
<i class="glyph-danger glyph fa fa-exclamation-triangle"></i>
</span>
</div>
ui_formula_field "value", status: :success
<div class="input-group has-success ui_formula_field">
<input type="text" name="value" id="value" value="" placeholder="Type your formula..." class="ui_formula_field_input form-control">
<span class="ui_formula_field_sign input-group-addon">=</span>
<input type="text" name="value_formula" id="another_value_formula" value="" readonly="readonly" class="ui_formula_field_result form-control">
<span class="ui_formula_field_alert input-group-addon" data-toggle="tooltip">
<i class="glyph-danger glyph fa fa-exclamation-triangle"></i>
</span>
</div>
ui_formula_field "value", ui_formula_field_name: :another_value_formula
<div class="input-group ui_formula_field">
<input type="text" name="value" id="value" value="" placeholder="Type your formula..." class="ui_formula_field_input form-control">
<span class="ui_formula_field_sign input-group-addon">=</span>
<input type="text" name="value_formula" id="another_value_formula" value="" readonly="readonly" class="ui_formula_field_result form-control">
<span class="ui_formula_field_alert input-group-addon" data-toggle="tooltip">
<i class="glyph-danger glyph fa fa-exclamation-triangle"></i>
</span>
</div>
Ui Bibz is compatible with simple form.
You can use defaults inputs of Simple Form and defaults inputs of Ui Bibz like ui_formula_field
. You can use Simple Form input options and Ui Bibz ui_formula_field options.
ui_form_for(@search) do |f|
...
f.input :price, as: :ui_formula_field
...
end