Infopath 2007 Core JS inside
File Path:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\INC
What is Core.Js?
- Server Response Json
- Core.Js deserialize and serialize
- Core.Js Build Html
- Core.Js Catch Control Events
Import Functions:
Loading
PostbackBody.OnLoad();
Control Events
a. ControlType:Button, TextBox, RadioButton…
b. BaseType: BaseControl
c. Functions: OnChange, OnFocus, OnClick….
d. How To Use?
var funcGetValueFromControl = BaseControl.FindFunction(objControl, "GetValueFromControl", false); var strFormattedValue = funcGetValueFromControl(objControl);
How TO Know What Type Is The Control?
var objSnippetElement = ViewDataNode_GetSnippetElement(objViewDataNode); var scriptClass = Snippet.GetScriptClass(objSnippetElement); scriptClass is a enum, such as “RadioButton”, “TextBox”.. objSnippetElement is a array, contains HTML attributes
General Functions
ViewDataNode.OnControlChange //every control change or click or focus
Add To Json
Json is saving in a parameter “EventLog”.
EventLog_AddPrivate( 0,objControl,objControl.id, "", //parent id "", //value false);
PostBack
View_SubmitForm(false, 0, 1, false); //note the paramenter for this function
Dialogs
Show Dialog:
function showDialog(msg) { try { var enumDialog = "Progress"; var arrDialogTemplate = Dialog.GetTemplate(enumDialog); var arrDialogInfo = Dialog.GetInfo(enumDialog); var strDialogName = DialogInfo.GetDialogName(arrDialogInfo); var enumPageBackGround = DialogInfo.GetPageBackgroundType(arrDialogInfo); Dialog.enumPageBackGround = enumPageBackGround; Dialog.arrDialogTemplate = arrDialogTemplate; var objDialog = document.getElementById("__DialogTable"); if (objDialog != null) { if (objDialog.style.display != "block" || objDialog.style.zIndex == "-250") { objDialog.style.display = "block"; objDialog.style.zIndex = ""; } } var objDialog = document.getElementById("__DialogContainer"); arrDialogInfo[arrDialogTemplate[1]] = msg; objDialog.innerHTML = Dialog.RenderDialogTemplate(Dialog.arrDialogTemplate, arrDialogInfo); Dialog._RestoreSizeAndPosition(); objDialog.style.display = "block"; } catch (e) { } }
Hide dialog:
Dialog._HideTable(); var objDialog = document.getElementById("__DialogContainer"); objDialog.style.display = "none"; |