Often business comes with a requirement that they need to store data in the sharepoint list, however they need some information to be displayed on the New item page.
These kind of requirements although look very simple from business point of view, it becomes a nightmare if you want to create custom pages for it.
"Terms and conditions" option is one such requirement. Although you can implement it in various ways, here is a good option to create "T&C" text on new items page and enable the form only when these "T&C" are agreed.
2. Create the desired columns for the List/Document Library created
3. Open the http://spsite/Lists/
4. Now the newform.aspx page opens in edit mode.
5. Add a content editor webpart in the page. This content editor webpart should be added just above the fields of the form.
6. Add following HTML code in the webpart.
<div style="text-align: left"> </div> <table width="100%" border="0" cellspacing="0" cellpadding="0" style="text-align: left"><tbody><tr><td> REPLACE THIS WITH YOUR TERMS AND CONDITIONS <br/><br/> <font style="font-size: 12pt"> <input id="chkAgreement" onclick="apply()" type="checkbox" value="on"/> <strong>I AGREE</strong></font><br/><br/ <br/></font></td></tr></tbody> <script type="text/javascript"> function hideload() { var imag = document.getElementsByTagName( for(var i=0;i<imag.length;i++) { } var ribbonhide = document.getElementById("s4- var stylechng = tbl.style; var stylechng2 = tbl2.style; var stylechng3 = ribbonhide.style; stylechng.display = 'none'; stylechng2.display = 'none'; stylechng3.display = 'none'; } function apply() { var imag = document.getElementsByTagName( for(var i=0;i<imag.length;i++) { } var ribbonhide = document.getElementById("s4- var chkBx = document.getElementById(" var stylechng = tbl.style; var stylechng2 = tbl2.style; var stylechng3 = ribbonhide.style; if(chkBx.checked==false) { stylechng.display = 'none'; stylechng2.display = 'none'; stylechng3.display = 'none'; } else { stylechng.display = 'block'; stylechng2.display = 'block'; stylechng3.display = 'none'; } }
hideload();</script>
|
8. Add following HTML code in the webpart.
<script>
hideload();</script>
|
Done.
If you don’t want to touch the ribbon control please remove the greyed out line above. Hiding the ribbon can be tricky as you might find it difficult to modify the webparts. But it gives a very good look and feel to the page if you remove it.
So if you have hidden the ribbon, you can edit the page by first closing content webpart, deployed in step 7 and 8. Then edit the page and redeploy the closed webpart.
No comments:
Post a Comment