Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text Area Component allows input of negative value in the Rows field #1555

Open
breagol37 opened this issue Apr 25, 2024 · 1 comment · May be fixed by #1558
Open

Text Area Component allows input of negative value in the Rows field #1555

breagol37 opened this issue Apr 25, 2024 · 1 comment · May be fixed by #1558

Comments

@breagol37
Copy link

breagol37 commented Apr 25, 2024

Description:

When editing the Text Area component's Rows field will allow you to input negative values.

Environment Details:

  • formBuilder Version: 3.19.7
  • Browser: Chrome
  • OS: Windows

Expected Behavior

The negative should be removed as the same behaviour in the Max Length field

Actual Behavior

Negative does not get removed

Steps to Reproduce

  • Add a Text Area component to your form and select edit.
  • Either type or use the incrementation buttons to add a negative number under the Rows field.
@lucasnetau
Copy link
Collaborator

Thank you @breagol37 for your report. This patch will treat rows in the same way as maxlength. The function utils.forceNumber() is only used by the maxlength field and really is a force string to positive integer, I'll make a note to update that function signature

diff --git a/src/js/form-builder.js b/src/js/form-builder.js
index 1761fdf..120f403 100644
--- a/src/js/form-builder.js
+++ b/src/js/form-builder.js
@@ -1817,7 +1817,7 @@ function FormBuilder(opts, element, $) {
     }
   })
 
-  $stage.on('blur', 'input.fld-maxlength', e => {
+  $stage.on('blur', 'input.fld-maxlength, input.fld-rows', e => {
     e.target.value = forceNumber(e.target.value)
   })
 
diff --git a/src/sass/_stage.scss b/src/sass/_stage.scss
index abe31b2..382560f 100644
--- a/src/sass/_stage.scss
+++ b/src/sass/_stage.scss
@@ -656,7 +656,7 @@
         border: 1px solid $error;
       }
 
-      &.fld-maxlength {
+      &.fld-maxlength, &.fld-rows {
         width: 75px;
       }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants