Scripting in MS sample forms

P

Philip Colmer

I'm trying to understand how the Purchase Request form works from the
scripting perspective. I'm looking at the javascript in the script editor
but I can't actually see how, for example, entering a unit price causes the
script code to fire.

Can someone please explain it as I want to replicate the functionality in a
new form.

Thanks.

--Philip
 
S

S.Y.M. Wong-A-Ton

Open the Data Source pane and then click on the unit price field on the form.
In the Data Source pane you will see that "estimatedUnitPrice" is a child
node of the "item" repeating group. If you look in code for an event handler
for the "item" repeating group, you will find the following function:

function msoxd_item::OnAfterChange(oEvent)

If you look at the beginning of this function you will see that the node
that has changed is retrieved (strChangedNode). Some checks are then
performed and at the end of the function you see the calculation being
performed

calculateItem(oEvent.Site);
 
P

Philip Colmer

Thank you for that explanation.

The code has comments that says the function handler is generated
automatically. This suggests that InfoPath created the handler through some
user action, What I'm not sure about is what that user action is or could
be. The repeating table doesn't have any rules set on it. Neither "item" nor
"estimatedUnitPrice" have event handlers set on them in the GUI.

So I'm puzzled: how does a user recreate this scenario in a new form?

--Philip
 
S

S.Y.M. Wong-A-Ton

Good one! Don't know. Perhaps a copy/paste/rename action? It's best to repost
your question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top