Javascript help


attached is my script. I am using SharePoint javascript client object model and my getlocations function is retrieving all list items and determining the value of the assessment status field to plot the correct color icon on the map.

Now, how do modify this code so that when a user selects 'Complete' option , In progress option or 'Not started' option the client object model returns only those items that correspond to AssessmentStatus = Complete, Assessment Status = In Progress or Assessment status = Not started.

i am not sure how to re use the code from Get locations function.  Get locations returns all items.

Please help:

let me know if you have any questions
Who is Participating?
Saw js in topics, better ask another expert. Cheers.
Kyle HamiltonData ScientistCommented:
please attach script :)
Could be (if the ass.status is an input box):
var myElement = document.getElementsByTagName("input");
for (var i=0; i<myElement.length; i++) {
	if (myElement[i].value=="Complete" || myElement[i].value=="In progress" || myElement[i].value=="Not started") {
		(send myElement[i].value to destination)
	} else {

Open in new window

depending on the structure of your elements (es. do you have named them with a certain criteria? Do you have radio buttons, check buttons or multiple select) and on the type of result you want to send/produce.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

TechsavyAuthor Commented:
Sorry forgot to attach. here it is ..
First of all, I see that your radio buttons do not have value="yes" or "no" but string values.
Second, they all call onclick="Map_refreshLayer("(string)") even if this function is not defined in the script below, where you call another function named "setIcon" which seems to be defined to do what you are intending to.
TechsavyAuthor Commented:
ok i think i confused you.

the radio button onclick event works when the button is clicked which implies a value of 'yes'.

so i have four radio buttons one for 'All', 'Complete', "In progress" and "Not Started".

So if you notice, for the "All" radio button, I want to show all the points which is a default selection and which i what is GetLocations() function is doing.

Now Map_refreshLayer("string")  here  we pass status as the string and the Map_refreshlayer should do exactly the same but, filtered to the values that has a  status = passed string in the function.

the set status function is basically checking the status and is outputting all the points for "All" but based on the status different color icon is used for the point.

when we use setstatus function for Map_refreshlayer all the points will have same color.

Let me know if this makes sense. to address this question one needs to have an understanding of SharePoint client object model and a very little bit idea of Bing maps Ajax v6.3 api.

let me know if this helps,

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.