1

I have a list with these columns Question, answer, Issue, Top FAQ, Summary, Q.No. The list is in a webpart on a wiki home page. When the user clicks on the link it brings all fields up. What I want is javascript code so that when user clicks they see question, answer, issue only. I am not what form to add the javascript - display, edit, new form.

2 Answers 2

1

If I do not misunderstand you could use jQuery to hide data from the display form (/Lists/YOUR_LIST_NAME/DispForm.aspx). Put the code in a .txt in a Document Library and link it from a Content Editor WebPart, modifying the DispForm page.

An example of code could be:

<script src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready(function() {
    $(".ms-formtable tbody > tr > td:contains('Top Faq')").closest("tr").hide();
    $(".ms-formtable tbody > tr > td:contains('Q.No')").closest("tr").hide();
})
</script>
0

I just posted this to codeplex this morning! https://lozzisp2013.codeplex.com/

Really simple to use, with more options around disabling and hiding.

<script type="text/javasccript">
$(document).ready(function(){
   Lozzi.Fields.disableWithAllowance("Start Date", ["Project Managers"]);
   Lozzi.Fields.disable("Task Status");
   Lozzi.Fields.hideWithAllowance("Predessor");
   Lozzi.Fields.hide("% Complete");
});
</script>
2
  • So I understand. What does the disable do. in your first lozzi statement, start date the column and project managers the name of the list. This is put into a .txt document and linked in a content editor webpart in the List < Form Web Parts > Default Display form? Jan 14, 2014 at 18:38
  • the disable will take the value and just display it as text, outside of the control, so users can't edit it. See my post, davidlozzi.com/2014/01/14/…, for more details and a screen shot. The ["Project Managers"] piece is the name of a SP Group which is allowed to edit it, so it'll disable for all users except for those in the group. Jan 15, 2014 at 1:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.