0
votes

On APEX 5.0, I tried to add date validation in "From" date of my form to show errors on page when From date entered is today's date. On processing page I created new validation name with following settings. With below settings still the validation is not working, could you please suggest where I am doing wrong.

Type -> PL/SQL expression 2)PL/SQL expression -> to_char(to_date(:P5_NEW_8,'YYYY-MM-DD-HH24:MI:SS'),'YYYY-MM-DD-HH24:MI:SS') < to_char(sysdate,'YYYY-MM-DD-HH24:MI:SS') where P5_NEW_8 is the "From" date picker item where date entered is of format YYYY-MM-DD-HH24:MI:SS.

Error message -> From: date needs to before today

Associated Item -> P5_NEW_8

Condition -> When Button Pressed -> New_7

New_7 button has a dynamic action to display result on my bar chart.

Condition Type -> Request is contained in Value

Value -> Create, Save

1
How is it not working?is there an error showing?is the buttong not displaying?please be detailed about your problem.thanks - brenners1302
when I click on the button for which the condition is "When button pressed" ,the validation should occur for the date picker item which is not happening. - Mukul Sharma
just try removing the condition type under the dynamic action, so you can submit the page.just to see whether the validation is working - brenners1302
I removed "Request is contained in Value" from condition type but still the validation is not working. what else shall I check? - Mukul Sharma
Have you tried setting the action of the button to submit page? - brenners1302

1 Answers

1
votes

There is no need to cast the dates to varchar2, by doing that you are doing string comparison i.e. 12-01-2010 is larger then 02-09-2016, not date comparison.

So use instead a simpler: to_date(:P5_NEW_8,'YYYY-MM-DD-HH24:MI:SS') < sysdate