Steps to create a web resource and bind it to a form.
|"Movie" Entity Record|
|New Web Resource Form|
|New Web Resource Values|
|Publish the Web Resource|
This function "OnLoad" will be bounded to the "Onload" event of the "Movies" entity form. I have named this function as "Onload" but you can give any name. This function checks the values in the 2 fields "new_costofproduction" and "new_revenue". If the value of "new_costofproduction" is less than value of "new_revenue", then there is a profit, or else there is a loss. If the values of "new_costofproduction" and "new_revenue" are the same, then there is no loss or profit.
|JScript file "Movies.DefaultForm.js" in Visual Studio 2010|
I will go to the "Movies" entity main form in the already opened solution "Movies".
|"Movies" Entity Main Form|
Click on the ribbon button "Form Properties".
|"Movies" Entity Main Form - Ribbon Button "Form Properties"|
|Form Properties Window|
My solution only one web resource "Movies DefaultForm". I will select that. Click "OK".
|"Look up" Window Listing all the Web Resources in the Solution|
|Web Resource is Added|
|Bind the Web Resource Function|
|Web Resource Function Added|
|"Save and Close" the "Movies" Entity Form|
|Publish the Movies Entity Form|
The movie "Skyfall" made losses, "Casino Royale" made a profit and "Die Another Day" has made no profit or loss.
|Movie made Losses|
|Movie made Profit|
|Movie made no Profit or Loss|
Below are 2 ways you can edit the code. The first screenshot displays the code inside the file "Movies.DefaultForm.js" which can be edited in any text editor. My preference and advice would be Visual Studio (in my case it is Visual Studio 2010). Visual Studio in my experience is the best IDE (Integrated Development Environment).
|File "Movies.DefaultForm.js" in IDE Visual Studio 2010|
|Web Resource Text Editor Button|
|JScript in Web Resource Text Editor|