Add client-side whitespace trimming for AR field names and labels
- Add form submit listener to trim field name and label inputs - Provides immediate feedback to users before server-side validation - Creates defense-in-depth approach with JS, route, and model layer trimming
This commit is contained in:
@@ -111,6 +111,20 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Trim whitespace from field name and label on form submission
|
||||
document.getElementById('fieldForm').addEventListener('submit', function(e) {
|
||||
var fieldNameInput = document.getElementById('fieldName');
|
||||
var labelInput = document.getElementById('label');
|
||||
|
||||
// Trim whitespace from inputs before submission
|
||||
if (fieldNameInput && !fieldNameInput.disabled) {
|
||||
fieldNameInput.value = fieldNameInput.value.trim();
|
||||
}
|
||||
if (labelInput) {
|
||||
labelInput.value = labelInput.value.trim();
|
||||
}
|
||||
});
|
||||
|
||||
function editField(button) {
|
||||
// Get data from button attributes
|
||||
var fieldData = {
|
||||
|
||||
Reference in New Issue
Block a user