Display Time only from button click - InfoPath Dev
in

InfoPath Dev

Display Time only from button click

Last post 08-15-2006 08:18 PM by Shiraz Cupala. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-15-2006 09:33 AM

    Display Time only from button click

    I have a form with two buttons and to text boxes.
    I have 1 text box and one button for Start time and stop time respectively.
    When I press the button "start time" I would like the textbox for "Start time" to display "hh/mm/(AM/PM)" without using managed code. (I have already done it in managed code but I would like to drop the code dependence on such a simple form)

    The textbox format is set to time with the correct format as described above. When I press the start button I ahve a function to set the textbox value to "now()". The textbox, however, does not format the time value correctly.

    Any ideas? I ahve read many of the time postings in here and none seem to really answer this specific problems. Also I do not want to use a DatePicker control.

    Thanks in advance!
  • 08-15-2006 09:57 AM In reply to

    Re: Display Time only from button click

    Nevermind. Solved it already. Here is what I did for the rest of you.

    1. I set a rule on the "Start Button" named "Click"
    2. I then created an action on the "Click" rule to set the vaule of the Textbox field to "now()"
    2. I then created a second action on the "Click" rulet o set the value of the Textbox to "substring-after(txtStart, "T")"

    I used the formula wizard so the above formulas are not XPath formulas and should not be typed directly in but created from the formula wizard.
    The true XPath formulas are below for those of you ho would like them.

    Action 1 = xdDate:Now()
    Action 2 = substring-after(my:txtStart, "T")

    Happy Coding!
  • 08-15-2006 08:18 PM In reply to

    Re: Display Time only from button click

    Thank you for sharing your solution in such detail.

    For folks who want to copy paste the formulas above into the formula dialog just check the box to "Edit XPath (advanced)". What this does is show and allow you to enter the formula raw. Note that the my:txtStart will have to be the correct node in your form.

    :)
    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.