Validation rules button not working on form input text fields when type not set

Wappler Version : 5.3.1
Operating System : Mac OS 10.15.7
Server Model: PHP
Database Type:
Hosting Type:

What do you think should happen?
When pressing the “VALIDATION RULES” button (+) on an input form field without “type=” set the context menu should show validation options for text input fields, as input fields without type set default to type “text”.

<input id="text1" name="text1" class="form-control"> = text input field.

What actually happens?
When pressing the “VALIDATION RULES” button (+) the “Required”-validation is automatically added and pressing (+) again does nothing.

How to reproduce

  1. Add a form, then add a text input field. (Notice in code view that this newly added field has the ‘type=“text”’ attribute set.)

  2. Press the “VALIDATION RULES” button (+) for the text input field. All appropriate text field options appear in a context meny for your selection, nothing is added automatically.

  3. Change the type of the text input field to “text” in the “TEXT INPUT PROPERTIES” even if it is already set to “text”. What happens in code view is that Wappler removes the ‘type=“text”’ attribute from the field since this is the default input type, thus no need to spell it out in code (you would think).
    (Why was it even set when the text field was added, I wonder?)

  4. Pressing the “VALIDATION RULES” button (+) again. The “Required”-validation is automatically added and pressing (+) again does nothing.

This has already been reported in a LOT of posts over the years, yet never accepted as a bug. Why?
The behavior when the user presses the (+) should be:

  1. Check if the field has the “type” set.
  2. If not; assume text field and present the text validation options in the context menu.

Another solution would be; stop changing the code on input fields when user selects the type “text”. If user wants to save those extra bytes the option “None” could be added to the type dropdown menu instead.

The solution presented in most posts about this old bug is to manually add the ‘type=“text”’ in code view. How about that for a “no coding” environment? :thinking:

1 Like

Fixed in Wappler 5.3.2