diff options
| author | Michaela Brückner <brueckner@data-quest.de> | 2024-01-02 08:55:04 +0000 |
|---|---|---|
| committer | Michaela Brückner <brueckner@data-quest.de> | 2024-01-02 08:55:04 +0000 |
| commit | 502e6a104f200acc2f8ff81ba09257a6035406e5 (patch) | |
| tree | 6c10c6662c822475c92814ec32d60951eda9cad8 /templates/forms | |
| parent | b6bdba58a8e090cb144bae382457c2e439d8a72a (diff) | |
new registry formular, re #1559
Closes #3533
Merge request studip/studip!1141
Diffstat (limited to 'templates/forms')
| -rw-r--r-- | templates/forms/confirm_password_input.php | 16 | ||||
| -rw-r--r-- | templates/forms/datalist_input.php | 22 | ||||
| -rw-r--r-- | templates/forms/form.php | 12 | ||||
| -rw-r--r-- | templates/forms/password_input.php | 16 | ||||
| -rw-r--r-- | templates/forms/radio_input.php | 16 | ||||
| -rw-r--r-- | templates/forms/range_input.php | 5 | ||||
| -rw-r--r-- | templates/forms/text_input.php | 13 |
7 files changed, 90 insertions, 10 deletions
diff --git a/templates/forms/confirm_password_input.php b/templates/forms/confirm_password_input.php new file mode 100644 index 0000000..e2e2583 --- /dev/null +++ b/templates/forms/confirm_password_input.php @@ -0,0 +1,16 @@ +<div class="formpart"> + <label <?= $this->required ? 'class="studiprequired"' : '' ?> for="<?= $id ?>"> + <span class="textlabel"> + <?= htmlReady($this->title) ?> + </span> + <? if ($this->required) : ?> + <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span> + <? endif ?> + <input type="password" + v-model="<?= htmlReady($this->name) ?>" + name="<?= htmlReady($this->name) ?>" + value="<?= htmlReady($this->value) ?>" + id="<?= $id ?>" <?= $this->required ? 'required aria-required="true"' : '' ?> + <?= $attributes ?>> + </label> +</div> diff --git a/templates/forms/datalist_input.php b/templates/forms/datalist_input.php new file mode 100644 index 0000000..7958c33 --- /dev/null +++ b/templates/forms/datalist_input.php @@ -0,0 +1,22 @@ +<div class="formpart"> + <label <?= $this->required ? 'class="studiprequired"' : '' ?> for="<?= $id ?>"> + <span class="textlabel"> + <?= htmlReady($this->title) ?> + </span> + <? if ($this->required) : ?> + <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span> + <? endif ?> + + <input type="text" list="<?= $this->title ?>" id="" v-model="<?= htmlReady($this->name) ?>" <?= $this->required ? 'required aria-required="true"' : '' ?> /> + + <datalist class="" id="<?= $this->title ?>" <?= $attributes ?>> + <? foreach ($options as $key => $option) : ?> + <option value="<?= htmlReady($option) ?>"<?= ($option == $value ? " selected" : "") ?>> + </option> + <? endforeach ?> + </datalist> + </label> + +</div> + + diff --git a/templates/forms/form.php b/templates/forms/form.php index 05b0b30..96cd2c0 100644 --- a/templates/forms/form.php +++ b/templates/forms/form.php @@ -2,14 +2,17 @@ $inputs = []; $allinputs = $form->getAllInputs(); $required_inputs = []; +$server_validation = false; foreach ($allinputs as $input) { foreach ($input->getAllInputNames() as $name) { $inputs[$name] = $input->getValue(); } - if ($input->required) { $required_inputs[] = $input->getName(); } + if ($input->hasValidation()) { + $server_validation = true; + } } $form_id = md5(uniqid()); ?><form v-cloak @@ -21,12 +24,14 @@ $form_id = md5(uniqid()); data-url="<?= htmlReady($form->getURL()) ?>" <? endif ?> @submit="submit" + @cancel="" novalidate <?= $form->getDataSecure() ? 'data-secure' : '' ?> id="<?= htmlReady($form_id) ?>" data-inputs="<?= htmlReady(json_encode($inputs)) ?>" data-debugmode="<?= htmlReady(json_encode($form->getDebugMode())) ?>" data-required="<?= htmlReady(json_encode($required_inputs)) ?>" + data-server_validation="<?= $server_validation ? 1 : 0?>" class="default studipform<?= $form->isCollapsable() ? ' collapsable' : '' ?>"> <?= CSRFProtection::tokenTag(['ref' => 'securityToken']) ?> @@ -52,7 +57,7 @@ $form_id = md5(uniqid()); <div v-if="STUDIPFORM_DISPLAYVALIDATION && (STUDIPFORM_VALIDATIONNOTES.length > 0)"> <?= _('Folgende Angaben müssen korrigiert werden, um das Formular abschicken zu können:') ?> <ul> - <li v-for="note in STUDIPFORM_VALIDATIONNOTES" :aria-describedby="note.describedby">{{ note.name + ": " + note.description }}</li> + <li v-for="note in ordererValidationNotes" :aria-describedby="note.describedby">{{ note.label.trim() + ": " + note.description }}</li> </ul> </div> </article> @@ -64,7 +69,8 @@ $form_id = md5(uniqid()); </div> <? if (!Request::isDialog()) : ?> <footer> - <?= \Studip\Button::create($form->getSaveButtonText(), $form->getSaveButtonName(), ['form' => $form_id]) ?> + <?= \Studip\Button::createAccept($form->getSaveButtonText(), $form->getSaveButtonName(), ['form' => $form_id]) ?> + <?= \Studip\LinkButton::createCancel($form->getCancelButtonText(), $form->getCancelButtonName()) ?> </footer> <? endif ?> </form> diff --git a/templates/forms/password_input.php b/templates/forms/password_input.php new file mode 100644 index 0000000..e2e2583 --- /dev/null +++ b/templates/forms/password_input.php @@ -0,0 +1,16 @@ +<div class="formpart"> + <label <?= $this->required ? 'class="studiprequired"' : '' ?> for="<?= $id ?>"> + <span class="textlabel"> + <?= htmlReady($this->title) ?> + </span> + <? if ($this->required) : ?> + <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span> + <? endif ?> + <input type="password" + v-model="<?= htmlReady($this->name) ?>" + name="<?= htmlReady($this->name) ?>" + value="<?= htmlReady($this->value) ?>" + id="<?= $id ?>" <?= $this->required ? 'required aria-required="true"' : '' ?> + <?= $attributes ?>> + </label> +</div> diff --git a/templates/forms/radio_input.php b/templates/forms/radio_input.php new file mode 100644 index 0000000..37170c9 --- /dev/null +++ b/templates/forms/radio_input.php @@ -0,0 +1,16 @@ +<div class="formpart"> + <section <?= $this->orientation == 'horizontal' ? 'class="hgroup"' : '' ?> for="<?= $id ?>"> + <span class="textlabel"> + <?= htmlReady($this->title) ?> + </span> + + <? foreach ($options as $key => $option) : ?> + <label class="" <?= $attributes ?>> + <input type="radio" + v-model="<?= htmlReady($this->name) ?>" + value="<?= htmlReady($key) ?>" <?= $key == $value ? 'checked' : '' ?>> + <?= htmlReady($option) ?> + </label> + <? endforeach ?> +</section> +</div> diff --git a/templates/forms/range_input.php b/templates/forms/range_input.php index c85b02d..07bd934 100644 --- a/templates/forms/range_input.php +++ b/templates/forms/range_input.php @@ -10,4 +10,7 @@ name="<?= htmlReady($name) ?>" value="<?= htmlReady($value) ?>" id="<?= $id ?>" - <?= $attributes ?>></range-input> + min="<?= $min ?>" + max="<?= $max ?>" + step="<?= $step ?>" + <?= $attributes ?>></range-input> diff --git a/templates/forms/text_input.php b/templates/forms/text_input.php index ae93758..3104ee8 100644 --- a/templates/forms/text_input.php +++ b/templates/forms/text_input.php @@ -6,11 +6,12 @@ <? if ($this->required) : ?> <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span> <? endif ?> + <input type="text" + v-model="<?= htmlReady($this->name) ?>" + name="<?= htmlReady($this->name) ?>" + value="<?= htmlReady($this->value) ?>" + id="<?= $id ?>" <?= ($this->required ? 'required aria-required="true"' : '') ?> + <?= $attributes ?>> </label> - <input type="text" - v-model="<?= htmlReady($this->name) ?>" - name="<?= htmlReady($this->name) ?>" - value="<?= htmlReady($this->value) ?>" - id="<?= $id ?>" <?= ($this->required ? 'required aria-required="true"' : '') ?> - <?= $attributes ?>> + </div> |
