Best practices to Write JavaScript for Project Online (Part 5)

Posted By Posted by: EPM Partners on July 4, 2017

Write values to PDP input fields 

If you have followed my previous blogs, you’d know how to tap an input field value on a PDP. Once you get the hang of it, you can perform many operations like hide it, lock it, move it etc. using simple JavaScript operations.

In one of my apps, I was a bit surprised to learn that setting a field value programmatically e.g.  (‘#YXZ’).val(‘123’) wasn’t sufficient for a PDP to detect that an input value has changed and it should save the value back to project when the save button is pressed.

So to simulate the experience as if an end user has typed the value, I had to trigger the JavaScript change event. This then successfully forced PDP infrastructure to save the value back to project. TypeScript code to write values back to PDP is as follows:

 

You can also download the code from https://gist.github.com/hammadbinarif/6a3312528040f717a510c0a3d0f55


Blog Posted In Blog Posted In: How to, Project Online
Blog Posted In Comments Off on Best practices to Write JavaScript for Project Online (Part 5)