This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Date Property Invisible after 48 hours of entry in a form

AbhishekSrivastava - Tuesday, December 29, 2015 4:42 AM:

Create a property date of entry in a item type and pick it up in a form.

When you fill form then after 48 hours date of entry property is automatically invisible.

 

So kindly help me , Is that possible?

Thank You in advance

Regards

Abhishek Srivastava



tstickel - Tuesday, December 29, 2015 10:51 AM:

Abhishek

Yes, it is possible to do what you are asking for by creating a javascript method called as an "OnFormPopulated" Form event.  This method would be automatically called before the form is displayed, but after its contents are initialized.  In this method you will need to get the date/time as of 48 hours ago and compare it to the value in the date_of_entry property.  This comparison may not be trivial to write in javascript, but it can be done with something like:

var compareDate = new Date();

compareDate.setDate(compareDate.getDate()-2); // This is 48 hours ago

entryDate = Date.parse(myItem.getProperty("date_of_entry")); // This converts the Innovator date to a javascript date object

if (entryDate <= compareDate) {

    getFieldByName("date_of_entry").style.visibility = "hidden";

}

I did not test this code, so there may be errors in it.

 



AbhishekSrivastava - Tuesday, April 5, 2016 9:00 AM:

Hi tstickel,

 

Error on form populated

Internal Error : My Item is not defined.