Wednesday, May 12, 2004

Extracting the current year in InfoPath

Had an interesting question that I thought would make a good post.

 

Question: As part of our form we are trying to get today’s date and then extract the year function out and populate that into a text box. How would we do that?

 

Answer: Using JavaScript you would do this using the following code behind a button.

 

var testDate = new Date(); var currentYear = testDate.getYear(); XDocument.DOM.selectSingleNode("//my:myFields/my:field1").text = currentYear;


10:35:38 PM    
comment [] trackback []