[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

CAML Query - People Picker Field - _ ALSO trigger when selection is made using SharePoint

Posted on 2015-02-02
1
Medium Priority
?
572 Views
Last Modified: 2015-04-22
I am working with an SPServices call and CAM Query. Trying to do a filter against a value in a People Picker field in SharePoint 2007.

I am continually getting an error on the execution of the Query no matter how I set up the parameters for the People Picker field. Please advise what I need to change. I need to filter against the current value in the People Picker input area.

A second issue is that I can have the code trigger when a value is manually entered into the input area but it won't trigger if the actual People Picker is used.

here is current code

function EmployeeCheck() {	
    //Setting variables
		ShowDialog = false;
		

        EmployeeID = $('textarea[title="People Picker"]').val(); 

		//Setting the CAML query
  		SPCAMLQuery = '<Query><Where><And><And><Includes><FieldRef Name="Field_x0020_Employee_x0020_Name" /><Value Type="Text">' + EmployeeID + '</Value></Includes><Geq><FieldRef Name="Date_x0020_of_x0020_Observation" /><Value IncludeTimeValue="FALSE" Type="DateTime">2014-01-01</Value></Geq></And><IsNull><FieldRef Name="Observation_CanceledReason" /></IsNull></And></Where></Query>';
    

Open in new window

0
Comment
Question by:aehrenwo
1 Comment
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 2000 total points
ID: 40727274
Hi,
the people picker is quite tricky - as the HTML DOM beyond from what you see in the browser is quite complicated.
But the following should exactly retrieve the displayed value:
jQuery("textarea[title='People Picker']").closest("td").find("#content").text();

Open in new window

For the second issue:
How have you implemented the triggers?
But perhaps the second one is worth an additional question.

Thanks and HTH
Rainer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month18 days, 1 hour left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question