Hello Experts,
Can you guide me how to save comparison result in a table field.
Scenario as below:
DB structure:
id
value1
value2
if_correct
Model:
[['value1','value2'], 'required'],
['value1', 'compare', 'compareAttribute'=>'value2', 'message'=>"incorrect"],
Form:
<div class="col-xs-5">
<?= $form->field($model, 'value1')?>
</div>
<div class="col-xs-5">
<?= $form->field($model, 'value2')?>
<?= Html::submitButton('Submit', ['class' => 'btn btn-success']) ?>
</div>
Now if we put the values in "value1" and "value2" and on submit the button, "value1" and "value2" will be compared.
If the values are same it will save "correct" in the "is_correct" field else it will save "incorrect" in the "is_correct" field along with the "valu1" and "value2" values.
Also should I set the "is_correct" field as "ENUM" in the database??
How can I achieve this?
Regards
Sid