0

I have a Secondary List(B) that my Primary List(A) uses to populate a field in InfoPath called 'Current Pay Period' which is a drop down. List B contains a calculated column to display dates since the Date Picker does not work as a LookUp Field. Initially, I set a Retention Policy on List B to delete entries [dates] that were older than one month so that the user has current dates in the InfoPath form to choose. Unfortunately, I forgot that deleting those items means older entries in List A with past dates will now have a blank entry.

Is there a way to filter the Current Pay Period drop down to only show dates for the Current Month in List A with jQuery - or only show future dates?

My assumption is that I'd have to write a script to get the currentDate and currentMonth, write an equation to determine if currentDate is still within the currentMonth, then use jquery's filter method to filter the options in the dropdown.

0

I was able to filter the dropdowns OOTB with InfoPath by filtering with the now() function. For others looking for this functionality, here are the steps I performed:

  1. Go to Drop-Down List Box Properties for the field you want filtered. Click X-Path icon on 'Entries'. Under dataFields, selected 'd;SharePointListItem_RW' and then click 'Filter Data' Click Add to add a Filter.

  2. In the first dropdown, select the Field whose values you want filtered. In the second dropdown, select 'is greater than or equal to' [or whatever condition suits your needs]. In the last dropdown, select Use a Formula. In the dialog box, enter

    concat(number(substring(now(), 6, 2)), "/", number(substring(now(), 9, 2)), "/", number(substring(now(), 1, 4)))

    (This formula is to ensure the date format for the now() function renders in the same format that the date values from the SharePoint Lookup Field are in so the comparison behaves accurately. For a comprehensive breakdown of the formula, go here: http://www.infopathdev.com/forums/p/20434/75629.aspx ).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.