Validate dates and times

Hello! I need help :)

I have a doubt that I do not know how to do it.

I want to validate the hours field and the minutes field in this way:

• From April 1 to September 30, effective hours will be 7.

• From October 1 to March 31, the effective hours will be 7 and the minutes will be 33.

in my code:

a!sideBySideItem(
item:

a!integerField(
labelPosition: "ABOVE",
value: ri!Regis.hours,
saveInto: {ri!Regis.hours},
align: "LEFT"
),
width: "MINIMIZE"
),
a!sideBySideItem(
item:
a!textField(
labelPosition: "ABOVE",
value: " Hours ",
readOnly: true
),
width: "MINIMIZE"
),
a!sideBySideItem(
item:

a!integerField(
labelPosition: "ABOVE",
value: ri!Regis.minute,
saveInto: {ri!Regis.minute}
),
width: "MINIMIZE"
),
a!sideBySideItem(
item:
a!textField(
labelPosition: "ABOVE",
value: " Minute",
readOnly: true
)
)

thanks so much!!

  Discussion posts and replies are publicly visible

Parents
  • load(
    local!date,
    local!hours,
    local!minute,
    local!validationData,
    {
    a!dateField(
    label: "Date",
    value: local!date,
    saveInto: {
    local!date,
    a!save(
    local!validationData,
    if(
    isnull(
    local!date
    ),
    {},
    if(
    and(
    local!date >= todate(
    concat(
    "04/01/",
    year(
    local!date
    )
    )
    ),
    local!date <= todate(
    concat(
    "09/30/",
    year(
    local!date
    )
    )
    )
    ),
    {
    hours: 7,
    minutes: 0
    },
    {
    hours: 7,
    minutes: 30
    }
    )
    )
    ),
    a!save(
    local!hours,
    null
    ),
    a!save(
    local!minute,
    null
    )
    }
    ),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item: a!integerField(
    labelPosition: "ABOVE",
    value: local!hours,
    saveInto: {
    local!hours
    },
    align: "LEFT",
    readOnly: if(
    isnull(
    local!date
    ),
    true(),
    false()
    ),
    validations: if(
    isnull(
    local!hours
    ),
    {},
    if(
    local!hours > tointeger(
    local!validationData.hours
    ),
    "Not Valid",
    {}
    )
    )
    ),
    width: "MINIMIZE"
    ),
    a!sideBySideItem(
    item: a!textField(
    labelPosition: "ABOVE",
    value: " Hours ",
    readOnly: true
    ),
    width: "MINIMIZE"
    ),
    a!sideBySideItem(
    item: a!integerField(
    labelPosition: "ABOVE",
    value: local!minute,
    saveInto: {
    local!minute
    },
    readOnly: if(
    isnull(
    local!date
    ),
    true(),
    false()
    ),
    validations: if(
    isnull(
    local!minute
    ),
    {},
    if(
    local!minute > tointeger(
    local!validationData.minutes
    ),
    "Not Valid",
    {}
    )
    )
    ),
    width: "MINIMIZE"
    ),
    a!sideBySideItem(
    item: a!textField(
    labelPosition: "ABOVE",
    value: " Minute",
    readOnly: true
    )
    )
    }
    )
    }
    )

Reply
  • load(
    local!date,
    local!hours,
    local!minute,
    local!validationData,
    {
    a!dateField(
    label: "Date",
    value: local!date,
    saveInto: {
    local!date,
    a!save(
    local!validationData,
    if(
    isnull(
    local!date
    ),
    {},
    if(
    and(
    local!date >= todate(
    concat(
    "04/01/",
    year(
    local!date
    )
    )
    ),
    local!date <= todate(
    concat(
    "09/30/",
    year(
    local!date
    )
    )
    )
    ),
    {
    hours: 7,
    minutes: 0
    },
    {
    hours: 7,
    minutes: 30
    }
    )
    )
    ),
    a!save(
    local!hours,
    null
    ),
    a!save(
    local!minute,
    null
    )
    }
    ),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item: a!integerField(
    labelPosition: "ABOVE",
    value: local!hours,
    saveInto: {
    local!hours
    },
    align: "LEFT",
    readOnly: if(
    isnull(
    local!date
    ),
    true(),
    false()
    ),
    validations: if(
    isnull(
    local!hours
    ),
    {},
    if(
    local!hours > tointeger(
    local!validationData.hours
    ),
    "Not Valid",
    {}
    )
    )
    ),
    width: "MINIMIZE"
    ),
    a!sideBySideItem(
    item: a!textField(
    labelPosition: "ABOVE",
    value: " Hours ",
    readOnly: true
    ),
    width: "MINIMIZE"
    ),
    a!sideBySideItem(
    item: a!integerField(
    labelPosition: "ABOVE",
    value: local!minute,
    saveInto: {
    local!minute
    },
    readOnly: if(
    isnull(
    local!date
    ),
    true(),
    false()
    ),
    validations: if(
    isnull(
    local!minute
    ),
    {},
    if(
    local!minute > tointeger(
    local!validationData.minutes
    ),
    "Not Valid",
    {}
    )
    )
    ),
    width: "MINIMIZE"
    ),
    a!sideBySideItem(
    item: a!textField(
    labelPosition: "ABOVE",
    value: " Minute",
    readOnly: true
    )
    )
    }
    )
    }
    )

Children