10-08-2014, 05:54 PM
Hope the below code works out
'I have to validate that the application should not accept the date less that the current date. hoe to write the VB script code for this?
'The condition is application does not keep tracks of the date, but when i am entering the date it in a field and submitting the record it should not submit 'the record if the date is less than T+1. (T=current date).
'I have to validate that the application should not accept the date less that the current date. hoe to write the VB script code for this?
Code:
inputdate = cdate(Inputbox("Enter Date")) '10/8/2014
'msgbox inputdate 'displays user entered date
'msgbox date 'displays current date
If inputdate = date or inputdate > date then
'Browser("Browser").Page("Page").Frame("DatePicker").Set inputdate
msgbox "valid date "& inputdate
Else
msgbox "Date Should not be earlier than current date"
end if
'The condition is application does not keep tracks of the date, but when i am entering the date it in a field and submitting the record it should not submit 'the record if the date is less than T+1. (T=current date).
Code:
inputdate = cdate(Inputbox("Enter Date")) '10/8/2014
'msgbox inputdate 'displays user entered date
'msgbox dateadd("d",1,date) 'displays current date + 1 day
If inputdate = dateadd("d",1,date) then
'Browser("Browser").Page("Page").Frame("DatePicker").Set inputdate
msgbox "valid date "& inputdate
Else
msgbox "Enter a valid date Eg. Current Date" & "(" & Date & ")" & "+1 Day " & "i.e.,"& dateadd("d",1,date)
end if