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 ) ...
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...
MOSS 2007 sites can display drop down menus in the tabbed navigation across the top. Unfortunately there is not an easy check box to act ivate this functionality; instead things just have to be set up the right way. If you want your MOSS site to show drop down menus, make sure the following is true or walk through the following steps: 1. From the root of the parent site (Home) choose to create a new site (Site 1). Once that site is created, you will be in that new site. From here choose to create a new page. 2. Once that is created,choose to create another new site (SubSite 1). Then create a new page in SubSite1 3. Your site structure should resemble like this (Pic Shown below)
4. For each site in the Navigation settings, both Show Subsites and Show Pages should be checked. a. Select Site Actions - Site Settings - Modify Navigation. b. Check Show subsites and Show pages in the first row. 5. The end resul...
Comments
Post a Comment