Javascript help

Posted on 2012-09-08
Last Modified: 2012-10-01

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
Question by:Techsavy
    LVL 25

    Expert Comment

    by:Kyle Hamilton
    please attach script :)
    LVL 9

    Expert Comment

    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.

    Author Comment

    Sorry forgot to attach. here it is ..
    LVL 9

    Expert Comment

    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.

    Author Comment

    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,

    LVL 9

    Accepted Solution

    Saw js in topics, better ask another expert. Cheers.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Introduction HyperText Transfer Protocol ( or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
    How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
    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)
    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…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now