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

Add subtypes for short input, like email, phone or custom regex #1491

Merged
merged 2 commits into from
Nov 27, 2023

Conversation

susnux
Copy link
Collaborator

@susnux susnux commented Feb 7, 2023

Summary

Added sub types for the short input, optional types (fallback to normal text input):

  • numeric input
  • telephone number
  • email address
  • custom regular expression

Added validation fallbacks on the front end as not every browser supports those input types, so if they are not supported we still get some validation.
Regex are validated on front and back end to be compatible with both PCRE (PHP) and ECMA (JS).

Front end

vokoscreenNG-2023-02-08_12-07-19.mp4

Known issues

@susnux susnux added enhancement New feature or request php PHP related ticket javascript Javascript related ticket 2. developing Work in progress labels Feb 7, 2023
@susnux susnux added this to the 3.1 milestone Feb 7, 2023
@codecov
Copy link

codecov bot commented Feb 7, 2023

Codecov Report

Merging #1491 (22bf12b) into main (bb58617) will increase coverage by 0.97%.
Report is 2 commits behind head on main.
The diff coverage is 83.60%.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1491      +/-   ##
============================================
+ Coverage     42.98%   43.96%   +0.97%     
- Complexity      614      646      +32     
============================================
  Files            58       58              
  Lines          2489     2550      +61     
============================================
+ Hits           1070     1121      +51     
- Misses         1419     1429      +10     

@susnux susnux force-pushed the feat/short-validation branch 2 times, most recently from 48746b6 to 6f08e0f Compare February 8, 2023 11:19
@susnux susnux added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Feb 8, 2023
@jotoeri jotoeri modified the milestones: 3.1, 3.2 Feb 20, 2023
Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool, looks good design-wise! :)

Optional detail: "Telephone number" sounds a bit off and could be shortened to "Phone number".

@susnux susnux force-pushed the feat/short-validation branch 2 times, most recently from d35c918 to c7416e9 Compare February 23, 2023 11:43
@susnux
Copy link
Collaborator Author

susnux commented Feb 23, 2023

Very cool, looks good design-wise! :)

Thank you :)

Optional detail: "Telephone number" sounds a bit off and could be shortened to "Phone number".

I agree! Changed it.

Copy link
Member

@jotoeri jotoeri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huhh, that was a big one.
Sorry for that mass of comments, but it feels necessary. 🙈
Especially on the two contants files, there is on each one a bigger structure-comment. Maybe check them first. Most of the others are smaller things.

lib/Controller/ApiController.php Outdated Show resolved Hide resolved
lib/Constants.php Outdated Show resolved Hide resolved
lib/Service/FormsService.php Outdated Show resolved Hide resolved
lib/Constants.php Outdated Show resolved Hide resolved
src/models/constants.js Outdated Show resolved Hide resolved
src/utils/RegularExpression.js Outdated Show resolved Hide resolved
src/utils/RegularExpression.js Outdated Show resolved Hide resolved
src/utils/RegularExpression.js Outdated Show resolved Hide resolved
src/utils/RegularExpression.js Show resolved Hide resolved
src/utils/RegularExpression.js Outdated Show resolved Hide resolved
@susnux susnux force-pushed the feat/short-validation branch 3 times, most recently from d7facfc to 9354320 Compare March 5, 2023 21:20
@jotoeri jotoeri modified the milestones: 3.2, 3.3 Mar 5, 2023
@susnux susnux force-pushed the feat/short-validation branch 3 times, most recently from 0edb495 to 2cb5fe5 Compare March 5, 2023 22:18
@susnux susnux force-pushed the feat/short-validation branch 3 times, most recently from 01cd255 to 7d78653 Compare November 7, 2023 10:17
@susnux susnux force-pushed the feat/short-validation branch 4 times, most recently from 7cab21f to 4056b07 Compare November 20, 2023 18:29
Copy link
Collaborator

@Chartman123 Chartman123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try it in my dev instance this evening, but codewise looks good now :)

susnux and others added 2 commits November 27, 2023 14:48
* Add fallback validation for short input
  Some browsers do not provide input validation for all available types,
  e.g. firefox on desktop does not validate telephone numbers.
* Clicking the input should enable edit mode on create view

Co-authored-by: Chartman123 <[email protected]>
Co-authored-by: Ferdinand Thiessen <[email protected]>
Signed-off-by: Ferdinand Thiessen <[email protected]>
* Also validate `extraSettings` especially the regex for custom short input

Signed-off-by: Ferdinand Thiessen <[email protected]>
@Chartman123 Chartman123 merged commit 78182aa into main Nov 27, 2023
22 checks passed
@Chartman123 Chartman123 deleted the feat/short-validation branch November 27, 2023 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request javascript Javascript related ticket php PHP related ticket
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validation of singleline/short response, url, regex...
5 participants