The Contact Selector control is an ActiveX control but it is a special cased control, in that it can also be used in InfoPath browser forms. To use this control there are specific steps that need to be taken – let’s take a look at those now. Step 1 : Steps to add Contact Selector control to your Controls Task Pane 1) From the Controls Task Pane click "Add or Remove Custom Controls" link 2) Click the Add button 3) Add Custom Control Wizard select "ActiveX control" and click Next 4) This will display a list of controls , select "Contact Selector" ,click Next 5) Select “Don’t include a .cab file” and click Next 6) For Binding Property select Value and click Next 7) From the Field or group type box choose Field or group (any data type) and click Finish 8) Click Close and then click OK Step 2: Create the data structure for the Contact Selector Control The Contact Selector control needs to have a specific data structure to work properly – this is documented on...
SharePoint has a built in function called "PreSaveAction" that can be invoked to process anything before the form should submit. So now we will create a submit button which calls “PresaveActon” function. Once users Submits the form, PreSaveAction is executed. If PreSaveAction is returns true it will commit and redirect. If the PreSaveAction returns false, then the commit will not happen nor the redirect. Input Button Code: Replace this code <SharePoint:SaveButton runat="server" ControlMode="New" id="savebutton1"/> with <input type="button" value="Submit" name="btnSave" onclick="javascript: if(PreSaveAction()) {ddwrt:GenFireServerEvent('__commit;__redirect={http://<Site>/ SitePages/ThankYou.aspx}')}" /> Add Script in NewCustom Form. Now edit New custom newform.aspx and add content editor webpart and with below script <script type="text/javascript...
SharePoint provides a JavaScript array “_spBodyOnLoadFunctionNames”, any function to be executed onLoad needs to be added to this array e.g. _spBodyOnLoadFunctionNames.push("ExecuteMyFunctionOnLoad"); Now, why does your JavaScript function doesn’t execute if you just register it with ClientScript.RegisterStartupScript? Actually, content pages can’t execute JavaScript function on body load, reason; content pages can’t directly add a function to the body’s OnLoad event if master page contains the <body> element (which is mostly true). This array is basically a part of init.js located in “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\”. If you open the javascript file, you will notice the page onLoad event is handled by function _spBodyOnLoadWrapper, which further calls ProcessDefaultOnLoad, and this function executes all the function names added in array "_spBodyOnLoadFunctionNames". function addLoadEvent ( func ) ...
Comments
Post a Comment