2

I followed the steps in the link HERE to Show/Hide a field in a form, based on the value of another field.

What I am having an issue with now is getting this to work on a New List Form, that I created from SharePoint Designer. I have SharePoint foundation 2013, so no access to InfoPath or conditionally hiding a field. The New form needs to be created because of other restraints found within SharePoints default forms.

Any help is appreciated. Thank you

1 Answer 1

5

You can use Jquery (No need to SPUtility) to a show and hide a field based on your selected value by doing the following :

  • Open your customized new form via the browser.
  • Edit Page .

enter image description here

  • Add web Part > Add Script Editor .

enter image description here

Add the following code.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>

$(document).ready(function(){
//Show/hide columns based on Choice Field Selection
$("select[title='City']").change(function() {
if ($("select[title='City']").val() != "other")
{
$('nobr:contains("OtherCity")').closest('tr').hide();
}
else
{
$('nobr:contains("OtherCity")').closest('tr').show();
}
});
});

</script>

Note : City is the choice field and , OtherCity the field that you need to show or Hide , so replace this with your fields name

For step by step guide with images check Show / Hide fields based on choice field selection using JQuery in SharePoint

Check also alternative method via SPutility at Show / Hide fields based on a drop down field using SPUtility.js

1

Your Answer

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

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