Skip navigation
Currently Being Moderated

Change display pattern at  run time

May 1, 2006 10:12 AM

I have a date/time field which has display pattern set as MM/DD/YYYY...
During run time, if user clicks on a check box...the display should change to DD/MMM/YYYY...How can i do that?
 
Replies
  • Currently Being Moderated
    May 1, 2006 10:28 AM   in reply to (Marleen_L)
    You can do this with a little bit of script on your check box's Click event (in FormCalc in this example):
    if ($ == 1) then
    
    DateTimeField1.format.picture = "DD/MMM/YYYY"
    else
    DateTimeField1.format.picture = "MM/DD/YYYY"
    endif

    The trick is to know that in XFA, what Designer refers to as the "Display" picture is the <format> node which contains a <picture> which, in turn, contains the "display" picture; or, the picture used to format the field's value for display purposes.

    I've attached a sample form which demonstrates this.

    Stefan
    Adobe Systems
     
    |
    Mark as:
  • Currently Being Moderated
    May 1, 2006 10:29 AM   in reply to (Marleen_L)
    In the CheckBox's change event, add code that sets the field's format.picture.value:

    if (this.rawValue == 1)
    {
    // Box is checked; use one format
    DateTimeField1.format.picture.value = "YYYY-MM-DD";
    } else
    {
    // else use the other format
    DateTimeField1.format.picture.value = "DD-MM-YYYY";
    }
    --
    SteveX
    Adobe Systems
     
    |
    Mark as:
  • Currently Being Moderated
    May 1, 2006 11:18 AM   in reply to (Marleen_L)
    SteveX's sample script is essentially my FormCalc sample in JavaScript.

    Stefan
    Adobe Systems
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 5, 2010 10:20 AM   in reply to (Marleen_L)

    Just wondering if this was also possible for numeric fields? I can't seem to find any documentation on it for numeric fields.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)