Skip to content

Commit

Permalink
Fix number attributes not having front or back validation
Browse files Browse the repository at this point in the history
  • Loading branch information
eudaldca committed Dec 5, 2023
1 parent 2202e35 commit 6e7a3d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/Admin/Models/Instances.php
Original file line number Diff line number Diff line change
Expand Up @@ -660,10 +660,17 @@ function insertAttributes($param_arr)
}
parent::insert_one($sql);
break;
case "N":
// if the value isn't numeric, don't insert anything
if (!is_numeric($valor)) {
break;
}

$sql = 'insert into omp_values (inst_id, atri_id, text_val, date_val, num_val, img_info) values ('.$new_instance_id.', '.$atr_id.', '.$insert_chunk.');';
parent::insert_one($sql);
break;
default:
$sql = 'insert into omp_values (inst_id, atri_id, text_val, date_val, num_val, img_info) values ('.$new_instance_id.', '.$atr_id.', '.$insert_chunk.');';
// dd($sql);
parent::insert_one($sql);
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Admin/views/attributes/N.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="column column-text">
<div class="form-group">
<label for="{{$attribute_name}}" class="form-label">{{$attribute['caption']}}</label>
<input type="text" class="form-control" name="{{$attribute_name}}" value="@isset($attribute['atrib_values'][0]){{$attribute['atrib_values'][0]['num_val']}}@endisset">
<input type="number" class="form-control" name="{{$attribute_name}}" value="@isset($attribute['atrib_values'][0]){{$attribute['atrib_values'][0]['num_val']}}@endisset">
</div>
</div>
@endif
@endif

0 comments on commit 6e7a3d7

Please sign in to comment.