0

I want to display a field in my infopath form. The entry of that field should change based on the selection made from another drop down field.

For example, Whenever an item is selected from Courses Field (Management, Finance and Marketing).

I want to auto-fill the ExamDate field automatically to display the corresponding exam date based on the selection made from the Courses Field.

Both Courses Field and ExamDate field are part on the same SharePoint list. Any help?

Thankyou!

1

If the fields are all in a same list, you can check the Courses field and then set the date based on Courses field value with Jquery:

<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script type="text/javascript">
$( document ).ready(function() {
   $("select[title='Courses']").change(function() {
   var course=$( "select[title='Courses'] option:selected" ).text();
   console.log(course);
   if(course=="Marketing")
   {
      $("input[title='ExamDate']").val("11/14/2017")
   }
   else if (course=="Management")
   {
      $("input[title='ExamDate']").val("11/21/2017")

   }
    else if(course=="Finance")
   {
        $("input[title='ExamDate']").val("11/28/2017")

    }
  });
   });
</script>

Result:

enter image description here

enter image description here

enter image description here

  • Hi Jerry Zy, Thankyou for your answer but should i understand with that method that i have to put manually the courses name in the script ? I mentionned just 3 courses in my exemple but we have more thant 100 courses and each semester we have at least 20 new courses offered and sometimes the names of a course can changed. I would prefer a system that will managed that automatically. – djgibbs Nov 10 '17 at 15:06
  • You need to add another list to store the course and Exam Date relationship, then query the date based on the selected course – Jerry_MSFT Nov 14 '17 at 1:03
0

you are referring to a cascading drop down list where one rely's on the previous selected answer that determines what is shown in the next and so forth!

https://support.office.com/en-gb/article/Create-a-cascading-list-box-1702993d-d670-4d9b-8063-acabacb76605

0

If you are using infopath.

You can add a rule to the field to execute an action to Query Data (using Data Connections) that let you fill your other component.

When using data connection, you have several ways to query data in sharepoint. For example you can use the "Biblioteca o lista de sharepoint" option. This is the easiest way for fetching data. Adding a rule to a field/control

enter image description here

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.