add maxlength

This commit is contained in:
mrilyew 2024-12-20 16:13:09 +03:00
parent 94e2f440be
commit 245816508f
3 changed files with 12 additions and 6 deletions

View file

@ -315,12 +315,18 @@ final class UserPresenter extends OpenVKPresenter
\openvk\Web\Models\Entities\UserInfoEntities\AdditionalField::resetByOwner($this->user->id);
foreach($items as $new_field_info) {
$name = ovk_proc_strtr($new_field_info["name"], 50);
$text = ovk_proc_strtr($new_field_info["text"], 1000);
if(ctype_space($name) || ctype_space($text)) {
continue;
}
$place = (int)($new_field_info["place"]);
$new_field = new \openvk\Web\Models\Entities\UserInfoEntities\AdditionalField;
$new_field->setOwner($this->user->id);
$new_field->setName(ovk_proc_strtr($new_field_info["name"], 50));
$new_field->setText(ovk_proc_strtr($new_field_info["text"], 1000));
$new_field->setName($name);
$new_field->setText($text);
$new_field->setPlace([0, 1][$place] ? $place : 0);
$new_field->save();

View file

@ -400,7 +400,7 @@
{_additional_field_name}
</td>
<td>
<input name="name_{$f_iterator}" type="text" value="{$field->getName(false)}">
<input name="name_{$f_iterator}" maxlength="50" type="text" value="{$field->getName(false)}">
</td>
<td>
<div id="small_remove_button"></div>
@ -411,7 +411,7 @@
{_additional_field_text}
</td>
<td>
<textarea name="text_{$f_iterator}">{$field->getContent()}</textarea>
<textarea name="text_{$f_iterator}" maxlength="1000">{$field->getContent()}</textarea>
</td>
<td></td>
</tr>

View file

@ -2905,12 +2905,12 @@ u(document).on("click", "#additional_field_append", (e) => {
<tbody>
<tr>
<td width="150">${tr("additional_field_name")}</td>
<td><input name="name_${iterator}" type="text"></td>
<td><input name="name_${iterator}" type="text" maxlength="50"></td>
<td><div id="small_remove_button"></div></td>
</tr>
<tr>
<td valign="top">${tr("additional_field_text")}</td>
<td><textarea name="text_${iterator}"></textarea></td><td></td>
<td><textarea name="text_${iterator}" maxlength="1000"></textarea></td><td></td>
</tr>
<tr>
<td>${tr("additional_field_place")}</td>