1

I have two lists Created for my leave application in sharePoint. I need related information's come from related list (Leaveinfo) and display it on the textbox in Parent list (LeaveApply).

I have manged to display the logged in user on Empl: textbox in Leaveapply list. After that I want a comparison using Empl: field with user field of Leaveinfo list and get the related information called Casual Leave and display the information on No. of days Required field in LeaveApply list

Here are the two lists details

  1. LeaveApply

    • EmpId

    • No. Of Days Required :

enter image description here

  1. Leaveinfo

    • User

    • Casual Leave

enter image description here

Here is the code I have tried to achieve my solution, but it doesn't work for me to display Casual Leave value on No. of days Required field.

<script type="text/javascript">

$(document).ready(function() {
    var userName = $().SPServices.SPGetCurrentUser({
        fieldName: "Title"
    });
    $("input[Title='Empl:']").val(userName);

$().SPServices.SPCascadeDropdowns({ 
 relationshipList: "Leaveinfo",
 relationshipListParentColumn: "User",
 relationshipListChildColumn: "Casual Leave",
 parentColumn: "Empl:",
 childColumn: "No. Of Days Required :",
 debug: true });
});

</script>

I'm now believing that I have used the wrong logic as Cascade dropdown for this, and trying to achieve single data into textbox field rather than use the logic for Cascade dropdown.

can you please provide some sample javascript code to achieve this. I don't want to select any value on Leave list. Value should be filled automatically in the newform of leave list, and I'm using SharePoint foundation 2010, so can't go for Info-path as well.

  • Can someone provide any advice on how can we do this, please – Indranil Sarkar Nov 14 '13 at 13:25

Your Answer

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

Browse other questions tagged or ask your own question.