?
Solved

Javascript help

Posted on 2012-09-08
6
Medium Priority
?
443 Views
Last Modified: 2012-10-01
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
0
Comment
Question by:Techsavy
  • 3
  • 2
6 Comments
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 38380996
please attach script :)
0
 
LVL 9

Expert Comment

by:Sar1973
ID: 38381121
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.
0
 

Author Comment

by:Techsavy
ID: 38381295
Sorry forgot to attach. here it is ..
HWMapFrame.txt
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 9

Expert Comment

by:Sar1973
ID: 38381431
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.
0
 

Author Comment

by:Techsavy
ID: 38381553
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
0
 
LVL 9

Accepted Solution

by:
Sar1973 earned 1000 total points
ID: 38381841
Saw js in topics, better ask another expert. Cheers.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
Suggested Courses
Course of the Month17 days, 8 hours left to enroll

829 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