Trim input. Added logging.
This commit is contained in:
parent
ac1dcecff3
commit
e260261bda
2 changed files with 16 additions and 8 deletions
|
@ -95,6 +95,8 @@ class App.UiElement.date
|
||||||
item.find("[name=\"#{attribute.name}\"]").val(timestamp)
|
item.find("[name=\"#{attribute.name}\"]").val(timestamp)
|
||||||
|
|
||||||
@setParams: (item, attribute, time) ->
|
@setParams: (item, attribute, time) ->
|
||||||
|
App.Log.debug 'UiElement.date.setParams', time.toString()
|
||||||
|
|
||||||
if time.toString() is 'Invalid Date'
|
if time.toString() is 'Invalid Date'
|
||||||
@setShadowTimestamp(item, attribute)
|
@setShadowTimestamp(item, attribute)
|
||||||
return
|
return
|
||||||
|
@ -109,9 +111,10 @@ class App.UiElement.date
|
||||||
|
|
||||||
@getParams: (item) ->
|
@getParams: (item) ->
|
||||||
params = {}
|
params = {}
|
||||||
params.day = item.find('[data-item=day]').val()
|
params.day = item.find('[data-item=day]').val().trim()
|
||||||
params.month = item.find('[data-item=month]').val()
|
params.month = item.find('[data-item=month]').val().trim()
|
||||||
params.year = item.find('[data-item=year]').val()
|
params.year = item.find('[data-item=year]').val().trim()
|
||||||
|
App.Log.debug 'UiElement.date.getParams', params
|
||||||
params
|
params
|
||||||
|
|
||||||
@validation: (item, attribute, runtime) ->
|
@validation: (item, attribute, runtime) ->
|
||||||
|
@ -160,6 +163,7 @@ class App.UiElement.date
|
||||||
|
|
||||||
#formGroup = item.closest('.form-group')
|
#formGroup = item.closest('.form-group')
|
||||||
formGroup = item
|
formGroup = item
|
||||||
|
App.Log.debug 'UiElement.date.validation', errors
|
||||||
if !_.isEmpty(errors)
|
if !_.isEmpty(errors)
|
||||||
|
|
||||||
# if field is required, if not do not show error
|
# if field is required, if not do not show error
|
||||||
|
|
|
@ -109,6 +109,8 @@ class App.UiElement.datetime
|
||||||
item.find("[name=\"#{attribute.name}\"]").val(timestamp)
|
item.find("[name=\"#{attribute.name}\"]").val(timestamp)
|
||||||
|
|
||||||
@setParams: (item, attribute, time) ->
|
@setParams: (item, attribute, time) ->
|
||||||
|
App.Log.debug 'UiElement.datetime.setParams', time.toString()
|
||||||
|
|
||||||
if time.toString() is 'Invalid Date'
|
if time.toString() is 'Invalid Date'
|
||||||
@setShadowTimestamp(item, attribute)
|
@setShadowTimestamp(item, attribute)
|
||||||
return
|
return
|
||||||
|
@ -127,11 +129,12 @@ class App.UiElement.datetime
|
||||||
|
|
||||||
@getParams: (item) ->
|
@getParams: (item) ->
|
||||||
params = {}
|
params = {}
|
||||||
params.day = item.find('[data-item=day]').val()
|
params.day = item.find('[data-item=day]').val().trim()
|
||||||
params.month = item.find('[data-item=month]').val()
|
params.month = item.find('[data-item=month]').val().trim()
|
||||||
params.year = item.find('[data-item=year]').val()
|
params.year = item.find('[data-item=year]').val().trim()
|
||||||
params.hour = item.find('[data-item=hour]').val()
|
params.hour = item.find('[data-item=hour]').val().trim()
|
||||||
params.minute = item.find('[data-item=minute]').val()
|
params.minute = item.find('[data-item=minute]').val().trim()
|
||||||
|
App.Log.debug 'UiElement.datetime.getParams', params
|
||||||
params
|
params
|
||||||
|
|
||||||
@validation: (item, attribute, runtime) ->
|
@validation: (item, attribute, runtime) ->
|
||||||
|
@ -195,6 +198,7 @@ class App.UiElement.datetime
|
||||||
|
|
||||||
#formGroup = item.closest('.form-group')
|
#formGroup = item.closest('.form-group')
|
||||||
formGroup = item
|
formGroup = item
|
||||||
|
App.Log.debug 'UiElement.datetime.validation', errors
|
||||||
if !_.isEmpty(errors)
|
if !_.isEmpty(errors)
|
||||||
|
|
||||||
# if field is required, if not do not show error
|
# if field is required, if not do not show error
|
||||||
|
|
Loading…
Reference in a new issue