Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again - InfoPath Dev
in

InfoPath Dev

Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

Last post 05-12-2009 12:50 PM by Michael71. 19 replies.
Page 1 of 2 (20 items) 1 2 Next >
Sort Posts: Previous Next
  • 05-08-2009 10:21 AM

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283

    Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

    Hi,

    I want to do something simple, but it seem so dificult. I want to inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again each time. Say, if the user selects a different field on a dropdown box called Doors than the dropdown list contained the previous time; a date should be inserted in a text boxed called Door change date, so it can be promoted to the SharePoint Library. That way the apartment would know when was the door was changed.

  • 05-08-2009 10:44 AM In reply to

    Re: Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

    Hello:

    You need to set the rule on the field that is going to change. Given your example, you'd add the rule to the field that is bound to the Doors dropdown list. The rule would have an action to set a field's value. The field would be the DoorChangeDate field. Select the fx button next to the area where you can enter the value, and enter today() for your formula.

    I'd make the DoorChangeDate field a date data type rather than a string. You can do this by right clicking the field in the Main Data Source in the Data Source Task Pane. Change it from Text to Date.

    As an aside, in case you weren't aware of this, you don't need to display the field on the form if you don't want to. The field will still have the data value you've set.

    Hilary Stoupa

  • 05-08-2009 11:15 AM In reply to

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283

    Re: Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

    Hillary you are great!  I'll try this and get back with you.

    One more question. What if my doors are repeating and a user can insert multiple doors. Do I place the DoorChangeDate as a repeating field to capture each door change. Say if I had 4 doors and 3 was changed on different days.

  • 05-08-2009 12:12 PM In reply to

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283

    Re: Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

    Hillary,

    Wow! It works. My condition on the list that changes is

    DoorChanged is not equal to not(.)  and

    DoorChanged is not blank

    Set DoorUpgradeDate = Today() or Now() to better see the date changing when you change the dropdown list of door types

    ie. If you change to Now(), don't forget to change DoorUpadeDate to Time in the Data Source.

    This way when the user saves the form the new upgrade date will be promoted!

     

    Thanks Hillary!

     

     

     

  • 05-08-2009 01:04 PM In reply to

    Re: Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

    Glad it works. Just for the record, if you are using now() you want the target field to be datetime, not just time.

    Hilary Stoupa

  • 05-08-2009 01:22 PM In reply to

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283

    Re: Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

    That's what I meant. Sorry. It just shows the time. How can I make it show Date and the Time in the target field?

  • 05-08-2009 01:28 PM In reply to

    Re: Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

    Right click the control and look in the properties. You should see a format button on the first tab. Click it to see different formatting options....

    Hilary Stoupa

  • 05-08-2009 01:35 PM In reply to

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283

    Re: Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

    Under Date and Time Format it says:

    Date and time cannot be displayed in the same control. When I click a time format, the the Date format goes to Do not display date automatically; Vice versa) Is it that you can't store Date and time in the same control?

  • 05-08-2009 01:44 PM In reply to

    Re: Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

    Yes, you can. What kind of control is it? Is it a date picker? When I add a date picker to a new blank form and it is bound to a date time field, I have the option to display both. Perhaps delete the date picker and add it to your form again.

    Hilary Stoupa

  • 05-08-2009 02:03 PM In reply to

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283

    Re: Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

    The control was a text box, I deleted the text box and added a Date Picker. It still will not work.

  • 05-08-2009 02:25 PM In reply to

    Re: Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

    Attached to this post is a sample. Right click the link in the header, select Save As and save locally. Right click the saved file and select design to open in design mode. Preview and enter some text in the text field and enter or tab from the field. Rules will set the values in two date pickers. The top is just date, the bottom displays date and time.

    Hilary Stoupa

  • 05-08-2009 02:28 PM In reply to

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283

    Re: Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

    Thank you Hillary,

    I'll have to wait until I get home. Unable to down load at work.

  • 05-08-2009 02:28 PM In reply to

    Re: Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

    You know what? I just realized you are using a browser form. Date and Time cannot be displayed in the same control in a browser form (which is what you've basically been saying, isn't it!)

    Best I can think of is two text boxes right next to each other... no, wait! put in an expression box bound to your date time field and format it as text...

    Hilary Stoupa

  • 05-08-2009 02:33 PM In reply to

    Re: Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

    Here's another version, with an expression box to hold the date time. I set it to browser compatible, and don't get any warnings. I used some formula magic to pretty up the date time (took out that silly 't').

    Hilary Stoupa

  • 05-08-2009 03:22 PM In reply to

    • Michael71
    • Top 50 Contributor
      Male
    • Joined on 10-07-2006
    • Mclean, Virginia-USA
    • Posts 283

    Re: Inserting a Date into a text box when a user changes data in a control and saves the form to SharePoint again

     

    I have a question. If I have repeating doors that are upgraded or changed and I promote the date they changed for each door. Is it anyway to filter on this data or date once they are in the Library. I don't think so because repeating data only give you the option to merge one on top of the other or show the first repeating door. The user wants to be able to sort and filter on doors that has been upgraded and when. That's right I can just filter on a non repeating item, but maybe it's not feasible to show all those dates in the library and have the user to open the form to view that information. Let me know your thoughts please. 

Page 1 of 2 (20 items) 1 2 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.