Skip to content

Commit

Permalink
Get maxLength dynamically so no JS fallback works
Browse files Browse the repository at this point in the history
  • Loading branch information
iMattPro committed Dec 5, 2024
1 parent d80f971 commit 5c9ab4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion adm/style/event/acp_overall_footer_after.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{% if S_PWA_OPTIONS %}
<script>
const input = document.getElementById('pwa_short_name');
const maxLength = 12;
const maxLength = input.maxLength || 12;

input.maxLength = maxLength * 2;

input.addEventListener('input', () => {
// Use Array.from to count characters correctly
Expand Down
2 changes: 1 addition & 1 deletion event/listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public function pwa_short_sitename($value, $key)
{
$placeholder = $this->trim_shortname($this->config['sitename']);

return '<input id="' . $key . '" type="text" size="40" maxlength="24" name="config[' . $key . ']" value="' . $value . '" placeholder="' . $placeholder . '">';
return '<input id="' . $key . '" type="text" size="40" maxlength="12" name="config[' . $key . ']" value="' . $value . '" placeholder="' . $placeholder . '">';
}

/**
Expand Down

0 comments on commit 5c9ab4f

Please sign in to comment.