Hot answers tagged

10

So it seems that the order is : onPreRender field1 override function --> (set registerInitCallback, return html etc.) onPostRender onPreRender field2 override function --> (set registerInitCallback, return html etc.) onPostRender onPreRender field3 (non override field, standard SharePoint render) onPostRender ... > so on for all form fields. ...


7

After searching over internet I found the solution. I just needed to execute my function after the SP.JS gets loaded. So I added one line.ExecuteOrDelayUntilScriptLoaded(getResponsibleArray, "sp.js"); in my code. So my new code is : $(document).ready(function () { ExecuteOrDelayUntilScriptLoaded(getResponsibleArray, "sp.js"); }); (function () ...


6

Create a custom list form or go to your NewForm.aspx using SharePoint Designer. Place the below code where you would like to insert the Attachment Field <tr> <td width="190px" valign="top" class="ms-formlabel"> <h3 class="ms-standardheader"> <nobr>Attach Files</nobr> </h3> </td> <td valign="top" class="ms-...


6

Should be some thing like following var context = new SP.ClientContext.get_current(); var web = context.get_web(); var list = web.get_lists().getByTitle('Name of the List'); context.load(list, 'Id'); In the success, try var listId = list.get_id(); Update for web is undefined Run code under ExecuteOrDelayUntilScriptLoaded() ...


5

You can pass content type id as query string parameter ContentTypeId Sitecollection.com/lists/myListName/NewForm.aspx?ContentTypeId=0x0100123456789 You can easily find your content type id if you go to List settings, click on desired content type and find the id in URL (here it is called ctype parameter)


5

Yes you can. At least in SharePoint 2013 on-prem First create a new custom form. Go to the list where you want the new form and edit the form in SharePoint Designer. Then create a new form (1), give it a name (2), select which kind of form (3), option to set it als default (4) and click ok (5). Then open the newly created form in advanced mode (right ...


5

List -> List Settings -> there is some Info Path forms server settings link that leads to the page where you can remove customization. Changing default Edit/New pages will not help - you need to modify pages for default content type of this list if you want to go this route. You can also able to do this in SharePoint without needing SP Designer. Navigate ...


4

SUMMARY This is maybe more complex than you may want, but it can be done. You also have a choice of using a hacky technique (read to the section break after the first code sample) or using the information in the first part to do some real work and re-create the item creation routine on your NewItem form. As a disclaimer, I'm assuming that you're using SP ...


4

After searching for the issue for hours I found a solution which returns the data to SharePoint for Person or Group field. Thanks to author of this post. From this post , I got the idea. However in my case the only string to return to SharePoint is [{"Key":"i:<id>#.w|domain\\\\<UserLoginName>"}]. So, finally my piece of code to submit data ...


4

You can add you javascript code to NewForm.aspx. Place this code in the newform.aspx page under the line <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> <!-- dkf code modified to redirect page end --> </div> <div class="mainContent"> <!-- dkf code modified to redirect page --> <script ...


4

You can use the args-property in the Options for delivering Parameters into the modal dialog. Inside the Dialog you can request them using the commonModalDialogGetArguments()function


4

Maybe you can solve this with simple Validation settings on your list instead. Just from your requirements, you could do the following: To populate the todays date in ReqstDate , set the default value on the column in the list to Today. For the logic, go to list settings and add the following formula under Validation settings: AND([ReqstDate]<=Today(); ...


4

You can do it as <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" JSLink="~site\path\jslinkfile.js" />


4

Click add a new item in your list. Now the NewForm.aspx Form opens up. Edit this page and add a Script Editor or CEWP. Now use the Presave function (code written under this function executes when the 'save' button is clicked). You can add some code to the script editor or CEWP. Note: You need to add reference for Jquery in the code, on the top. See code ...


4

You can use HillbillyTabify.js to tabify SharePoint forms. reference : http://www.markrackley.net/2015/12/03/tabify-your-sharepoint-forms/


3

You have a couple options here. I usually do my editing of these forms in SharePoint designer. First navigate to the List and open the EditForm in 'Advanced Mode': Now, within the PlaceHolderAdditionalPageHead element, you can add your <style> block with CSS. Alternatively, you can add a ContentEditor web part directly in the EditForm with a <...


3

Try as below function renderTestField(ctx) { ctx.CurrentFieldValue = "TestText"; return SPFieldText_Edit(ctx); } You can set custom value as below also function renderTestField(ctx) { return '<input type="text" maxlength="255" id="Dig_x0020_ID_b5482683-9113-41be-b2ea-8095919a2fd4_$TextField" title="Dig ID" class="ms-long ms-spellcheck-true"...


3

In Sharepoint 2013, the person or group field no longer uses the old directory people picker. They have switched over to the autocomplete option (which however is cumbersome if you don't know what you are searching for). The list forms by default will use this 2013 autocomplete option but if you want to use the 2010 directory people picker, just create new ...


3

In PreSaveAction, you would just use jquery to get the field value and do your validation, basic example. function PreSaveAction() { var title= $("input[Title='Title']").val(); if(!title.length){ alert("oops, missed a field!"); return false; } else { return true; } } You could use SPServices functions too if you needed to ...


3

Editing Newform.aspx is not a Good Practice. Instead of editing default new form, Create a new form. This form will have all the code for each columns. You can add your CSS class to those columns for the Table and define your CSS for that class. Editing default form or default CSS is never considered as good practice. How to Create a Custom New form


3

To begin, go to List Settings > Advanced Settings: Select Yes on Allow management of content types?: Click on one of the existing content types under the Content Type section: Next, click on the column you intend to hide, and choose the option Hidden. Click OK: Go to the New Item tab and select the Edit form. You will see that, on both the New Item and ...


3

You can hide theses fields via Jquery without using SharePoint Designer by doing the following: Open your new form via the browser. Edit Page . Add web Part > Add Script Editor . Add the following code. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script> $(document).ready(function(){ //...


3

The key is to override the white-space-property within the nobr element which is the one where the text is located. Then you can define the standard width for your column titles on .ms-formlabel. .ms-formlabel { width: 400px; } .ms-formlabel nobr { white-space: normal; } Add the CSS either in the style sheet referenced in your master page, or to ...


3

I'm not a 100% sure on this, but here is what I normally do... Rather than keeping the script from reruning, the script should be able to run again without breaking the behaviour. You are telling the form to perform an action when a field changes, which is good for user input, but the script needs to know what to do if the value is already set (which should ...


3

Try with margin-left CSS。 Demo: <style type="text/css"> input[type="radio"] { margin-left: 10px; } </style> <input type="radio" checked="checked" name="edit" value="A">A <input type="radio" name="edit" value="B">B <input type="radio" name="edit" value="C">C Update: Try this JS code: &...


2

try using the below script on NewForm.aspx <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script><script type="text/javascript">function PreSaveAction() { var URL = location.pathname.replace('NewForm.aspx', 'DispForm.aspx'); if (GetUrlKeyValue('IsDlg') === '1') { URL +...


2

I have debug code on Office 365 and SharePoint, and have behavior equals. I see code onclick of the button SAVE: then, try create javascript file and add this method: function PreSaveItem(){ // add other your codes if(value == 'confirm'){ return true; // allow save form... } return false; // not allow save form // use return true; if confirm or return ...


2

Go to List Settings -> Click on Change new button order and default content type. You can control the order with Position from Top:


2

If you want to do this with default List forms. You can add JavaScript to your form to achieve this as explained in this article.


2

This is easily accomplished by using an InfoPath form. You can create a lookup to the user profile sync (syncs with AD): Link Alternatively, you might be able to create a workflow that copies the user from "Created By" field into "assigned to."


Only top voted, non community-wiki answers of a minimum length are eligible