Commit 84b634aa by Alfonso Abella

generateFields WG-484 in progress

parent b1bec4d7
...@@ -274,6 +274,7 @@ const inputString = (key, validation) => { ...@@ -274,6 +274,7 @@ const inputString = (key, validation) => {
const { const {
mandatory, mandatory,
fieldLength, fieldLength,
validDate,
collection collection
} = validation } = validation
...@@ -378,7 +379,8 @@ const inputDate = (key, validation) => { ...@@ -378,7 +379,8 @@ const inputDate = (key, validation) => {
try { try {
const { const {
mandatory, mandatory,
fieldLength fieldLength,
validDate
} = validation } = validation
const input = document.createElement('input') const input = document.createElement('input')
...@@ -388,7 +390,7 @@ const inputDate = (key, validation) => { ...@@ -388,7 +390,7 @@ const inputDate = (key, validation) => {
input.addEventListener('focusout', handleInput) input.addEventListener('focusout', handleInput)
mandatory ? input.setAttribute('required', 'true') : null mandatory ? input.setAttribute('required', 'true') : null
validDate ? input.setAttribute('validDate',validDate) : null
return input return input
} catch (err) { } catch (err) {
throw err throw err
...@@ -438,7 +440,8 @@ const inputDateRange = (key, validation) => { //Input date range is a field main ...@@ -438,7 +440,8 @@ const inputDateRange = (key, validation) => { //Input date range is a field main
try { try {
const { const {
mandatory, mandatory,
fieldLength fieldLength,
validDate
} = validation } = validation
const dateRangePicker = document.createElement('div') const dateRangePicker = document.createElement('div')
...@@ -458,6 +461,7 @@ const inputDateRange = (key, validation) => { //Input date range is a field main ...@@ -458,6 +461,7 @@ const inputDateRange = (key, validation) => { //Input date range is a field main
input.setAttribute('type', 'date') input.setAttribute('type', 'date')
input.addEventListener('focusout', handleInput) input.addEventListener('focusout', handleInput)
mandatory ? input.setAttribute('required', 'true') : null mandatory ? input.setAttribute('required', 'true') : null
validDate ? input.setAttribute('validDate',validDate) : null
startDate.setAttribute('class', 'dateContainer') startDate.setAttribute('class', 'dateContainer')
// "TO" Label // "TO" Label
...@@ -470,6 +474,7 @@ const inputDateRange = (key, validation) => { //Input date range is a field main ...@@ -470,6 +474,7 @@ const inputDateRange = (key, validation) => { //Input date range is a field main
input2.setAttribute('type', 'date') input2.setAttribute('type', 'date')
input2.addEventListener('focusout', handleInput) input2.addEventListener('focusout', handleInput)
mandatory ? input2.setAttribute('required', 'true') : null mandatory ? input2.setAttribute('required', 'true') : null
validDate ? input2.setAttribute('validDate',validDate) : null
endDate.setAttribute('class', 'dateContainer') endDate.setAttribute('class', 'dateContainer')
dateRangePicker.appendChild(dateRange); dateRangePicker.appendChild(dateRange);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment