Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rjs_json_form
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
rjs_json_form
Commits
b3eb39b1
Commit
b3eb39b1
authored
Sep 06, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use html5 attributes for limitation input fields string and number type
parent
9e2b6711
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
jsonform/gadget_json_generated_form_child.js
jsonform/gadget_json_generated_form_child.js
+20
-0
No files found.
jsonform/gadget_json_generated_form_child.js
View file @
b3eb39b1
...
@@ -940,6 +940,19 @@
...
@@ -940,6 +940,19 @@
if
(
type
===
"
number
"
)
{
if
(
type
===
"
number
"
)
{
input
.
setAttribute
(
"
step
"
,
"
any
"
);
input
.
setAttribute
(
"
step
"
,
"
any
"
);
}
}
if
(
json_field
.
multipleOf
&&
json_field
.
multipleOf
>=
0
)
{
input
.
step
=
json_field
.
multipleOf
;
}
if
(
json_field
.
minimum
&&
// step work from min value so we can't
// use min if min not multipleOf step
!
(
json_field
.
multipleOf
&&
(
json_field
.
minimum
%
json_field
.
multipleOf
)
!==
0
))
{
input
.
min
=
json_field
.
minimum
;
}
if
(
json_field
.
maximum
)
{
input
.
max
=
json_field
.
maximum
;
}
}
else
{
}
else
{
if
(
default_value
===
undefined
&&
typeof
json_field
.
default
===
"
string
"
)
{
if
(
default_value
===
undefined
&&
typeof
json_field
.
default
===
"
string
"
)
{
input
.
value
=
json_field
.
default
;
input
.
value
=
json_field
.
default
;
...
@@ -948,6 +961,13 @@
...
@@ -948,6 +961,13 @@
input
.
type
=
"
text
"
;
input
.
type
=
"
text
"
;
if
(
json_field
.
pattern
)
{
if
(
json_field
.
pattern
)
{
input
.
pattern
=
json_field
.
pattern
;
input
.
pattern
=
json_field
.
pattern
;
}
else
if
(
json_field
.
minLength
)
{
// minLength absent in html5 so
// use pattern for this task
input
.
pattern
=
"
.{
"
+
json_field
.
minLength
+
"
,}
"
;
}
if
(
json_field
.
maxLength
)
{
input
.
maxLength
=
json_field
.
maxLength
;
}
}
if
(
json_field
.
format
===
'
uri
'
)
{
if
(
json_field
.
format
===
'
uri
'
)
{
input
.
type
=
"
url
"
;
input
.
type
=
"
url
"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment