locked
Lightswitch HTML CLIENT - Leading zeros on Local Property RRS feed

  • Question

  • Hi all,

    I'm having some trouble to format a Local Property field to show leading zeros (i'm using it as an hour field). It's a local property (Integer) that on the created method of the screen i use getHours() to set the value.

    screen.LocalProperty = screen.Entity.DateBirth.getHours();

    In the properties of 'LocalProperty' i tried setting Format Pattern has: '00' ## 00 and none of this seemed to work, it's allways showing just one digit if it's between 0 and 9.

    Am i using a wrong format pattern or is there any bug related issue with the use of format patterns in the HTML client?

    I tested this with a completely new project just for testing format pattern and created a table named Entity with Id, Name(String), DateBirth(DateTime). Then created a Common Screen Set for Entity with Browse, View and Edit screen, and just added a Local Property named LocalProperty. It's not working :/

    EDIT:
    PS: The Validation doesn't seem to work either on the local property properties, i set minimum as 0 and maximum as 23, but it still allows me to change to values out of that range.

    Best regards,
    Johny


    • Edited by Johny Pingo Monday, December 21, 2015 11:34 AM more info
    Monday, December 21, 2015 11:31 AM

Answers

  • From the docs:

    The Format Pattern property applies only to screens in desktop clients for LightSwitch applications. For screens in an HTML client, you can apply formatting by writing JavaScript code in the postRender method of a screen.

    How to: Format Numbers and Dates in a LightSwitch Application

    The validation works here for me:

    Cheers

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    • Proposed as answer by Xpert360 Tuesday, December 22, 2015 8:48 AM
    • Marked as answer by Johny Pingo Tuesday, December 22, 2015 9:30 AM
    Tuesday, December 22, 2015 8:48 AM