Link to home
Start Free TrialLog in
Avatar of Techsavy
Techsavy

asked on

Javascript help

Hi,

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
Avatar of Kyle Hamilton
Kyle Hamilton
Flag of United States of America image

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.
Avatar of Techsavy
Techsavy

ASKER

Sorry forgot to attach. here it is ..
HWMapFrame.txt
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.
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,

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Sar1973
Sar1973
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial