mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Tab Betriebsmittel: change type of field Kaution to number, add validation if numeric
This commit is contained in:
@@ -158,6 +158,11 @@ class BetriebsmittelP extends FHCAPI_Controller
|
||||
], [
|
||||
'uid_in_person' => $this->p->t('person', 'error_uidNotInPerson')
|
||||
]);
|
||||
|
||||
$this->form_validation->set_rules('kaution', 'Kaution', 'numeric', [
|
||||
'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Kaution'])
|
||||
]);
|
||||
|
||||
$this->validateNewOrUpdate();
|
||||
|
||||
$betriebsmitteltyp = $this->input->post('betriebsmitteltyp');
|
||||
@@ -241,6 +246,10 @@ class BetriebsmittelP extends FHCAPI_Controller
|
||||
|
||||
public function updateBetriebsmittel($betriebsmittelperson_id)
|
||||
{
|
||||
$this->form_validation->set_rules('kaution', 'Kaution', 'numeric', [
|
||||
'numeric' => $this->p->t('ui', 'error_fieldNotNumeric', ['field' => 'Kaution'])
|
||||
]);
|
||||
|
||||
$this->validateNewOrUpdate();
|
||||
|
||||
$betriebsmitteltyp = $this->input->post('betriebsmitteltyp');
|
||||
|
||||
@@ -292,6 +292,12 @@ export default {
|
||||
this.formData.anmerkung = null;
|
||||
this.formData.beschreibung = null;
|
||||
this.statusNew = true;
|
||||
},
|
||||
//helper function: workaround to trigger validation if input is not a number
|
||||
normalizeKaution() {
|
||||
if (this.formData.kaution === null || this.formData.kaution === '') {
|
||||
this.formData.kaution = 'xxx'
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -401,9 +407,10 @@ export default {
|
||||
|
||||
<div class="row mb-3">
|
||||
<form-input
|
||||
type="text"
|
||||
type="number"
|
||||
:label="$p.t('infocenter/kaution')"
|
||||
name="kaution"
|
||||
@blur="normalizeKaution"
|
||||
v-model="formData.kaution"
|
||||
>
|
||||
</form-input>
|
||||
|
||||
Reference in New Issue
Block a user