0

I am working with a SharePoint Online.
I am very new to SharePoint and JS in general (so I am no expert - but willing to learn).

I have created a List that contains the following fields:
A, B, C.

A , B are dropdown choices that let's say contain One, Two, Three with Three as the Default choice in B.

What I need to happen is as follows:
If A="One and B="Two" Then I want C to be visible so that I may write in an answer. Otherwise I want C to remain hidden.

To explain it another way: I have three columns (Fields) and want the third to remain hidden until the first two columns (fields) contain the value necessary to make the third visible.

0

possible duplicate of this question

You can achieve this via SPUtility.Js as stated in the answer posted in the link.

With that you can write the script as follow

<script src="/Shared%20Documents/jquery-1.10.2.min.js"></script>
<script src="/Shared%20Documents/sputility.min.js"></script>

<script>
// wait for the window to load
$(document).ready(function () {
    // Get a single select dropdown field
    var countryField = SPUtility.GetSPField('Country');

    // create a function to show or hide City based on Country's value
    var showOrHideField = function() {
        var countryFieldValue = countryField.GetValue();
        // Hide the City field if the selected value is Other
        if(countryFieldValue === 'Other') {
            SPUtility.HideSPField('City');
        }
        else {
            SPUtility.ShowSPField('City');
        }
    };

    // run at startup (for edit form)
    showOrHideField();

    // make sure if the user changes the value we handle it
    $(countryField.Dropdown).on('change', showOrHideField);
});
</script>
  • This is the "old" SharePoint 2010 way of doing this; look into SharePoint 2013 Client-Side-Rendering (CSR) for a modern approach – Danny '365CSI' Engelman Aug 12 '15 at 19:55
  • Vishwas, This did not work because as I stated in my posting, I am on a Version that is on the 360 cloud and not allowed to add any script files. I mean I can make this work on our old site, but given the fact that I can not get permission to add query files - this just did not work. Thanks for the info though... Much appreciated – ChuckD Aug 17 '15 at 11:46
0

You need some programming skills to achieve this.

SharePoint can not do it out-of-the-box.

The usual approach was to use InfoPath for these type of (more logic) forms.

The future of InfoPath is unsure, current versions will be supported till 2023 (or about)

It is still the best tool for your requirement. Only you can weigh the investment versus the time you need programming your own solution.

The programming route requires SharePoint Designer to edit the Forms and learning jQuery (you can do without and even most SharePoint programmers do not know about SharePoint native mQuery) and SP2013 Client Side Rendering (CSR) Javascript skills.

  • Danny, Thanks a bunch for the tip on InfoPath. I was able to do everything that I wanted to do from there and more... Easy and quick... Really appreciate the help and it gave a great looking form for my list. Again Thanks – ChuckD Aug 17 '15 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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