Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

So I came across a cool trick first in a book, then on a blog (here!), but it doesn't work for me. It's straightforward enough, couple lines of javascript/jquery, and a cewp in order to auto-select all day events, hide that as well as workspace and recurrence. Would this be caused by changes to jquery version since this is a bit dated? As I am using v1.7+ and this blog post shows reference to the 1.2.6 jquery cdn? Otherwise I can't figure it out??

<script type="text/javascript">
$(function() {
  $('td.ms-dttimeinput').hide();
  $('span[title=All Day Event] > input').attr("checked","checked"); 
  $('tr:has(span[title=Recurrence])').not('tr:has(tr)').hide(); 
  $('tr:has(span[title=All Day Event])').not('tr:has(tr)').hide();
  $('tr:has(span[title=Workspace])').not('tr:has(tr)').hide();
});
</script>

again my jquery reference is v1.7.1a which is in a doc library versus cdn. The post shows 1.2.6? Am I on the right track? Would changes to jquery be what is preventing me from getting this to work, and if so does anyone know the relative change?

I am sure that it is either this, or something I am doing wrong here, because JBH is the man and lots of his information has helped me out quite a bit!

thanks as always guys!

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I figured this one out, so here is what I used in case someone else is looking for a solution to this as well:

Below is what worked to hide a field for something like a id. So if I was passing an ID to the form through a query string, then I could hide the field containing the value from the user. Added this to the form by CEWP:

<script src="/sites/DevCollection/Style%20Library/scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function() {
       $("input[value='Save']").hide();
       $("table.ms-formtoolbar tr:first").hide();
       var fldItem = $("select[title='ParentID']");
       fldItem.hide();
</script>

same idea allowed me to hide calendar items on form, or really any field on any form.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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