Date Picker Conditions

N

Nina

I can make infopath change the color of some places if they are
more than or less than a number or whatever but i can't make it
change the color of the date picker if it gets more than a
specific date, is that possible? it just askes if i want to give
an error or not... what can i do?
 
F

Franck Dauché

Hi Nina,

You can do this by using xdExtension.

Right-click on your Date Picker
Go to Properties
Go to Display Tab
Click on "Conditional Formatting..."
Add
In the fist drop-down, select "The expression" and type:
xdExtension:TestMyDate() in the textbox on the right
Select the formatting from that screen (shading, etc.)
Click OK 3 times.

Go to Tools \ Programming \ MS Script Editor
type:
function TestMyDate()
{
return true; //just to test
}

Inside TestMyDate() put the logic that you need.

Hope that it helps.

Regards,

Franck Dauché
 
N

Nina

Hi, Thanx but my problem is that for the date picker, when I go to the
display tab there is no conditional formating! there is only "Placeholder"
and "Alignmenet"
 
F

Franck Dauché

Hi Nina,

You don't have a button with the label "Conditional Formatting" below the 2
boxes that you are refering to?
Are you running InfoPath SP1 or SP2?

Franck Dauché
 
N

Nina

Hi Frank,
No I don't have a "conditional Formatting" for the date picker! I have SP2
for windows but I just installed infopath from a CD I bought and I didn't
update anything for it. Should I download something for it?

Thanx
Nina
 
N

Nina

Hi, I used xdExtension but I don't know much programming so I don't know what
to write in MS Script Editor, you told me to write:
function TestMyDate()
{
return true; //just to test
}
Inside TestMyDate() put the logic that you need.

but I don't know what I have to write inside TestMyDate(). The logic is I
want the function to return true if the value of the field "Due_Date" is
greater than today's date. I tried replacing the "return true" line with:

If Due_Date > Date return true

but it didn't work.
What should I write?
Thanx
 
Top