Solved

jquery text boxes not rendering

Posted on 2013-05-14
4
235 Views
Last Modified: 2013-05-21
Please help!

I'm not sure why my text boxes are not showing.  4 input boxes are supposed to appear where you see the red marks below:
input not showing
Here's my code

function GetCurrentResult(xData, status) 
	{
		var currentYear = (new Date).getFullYear();

		//alert(xData.responseXML.<wbr ></wbr>xml);
		//Iterates through each row and returns information - Populates the "Performer" dropdown with values from the Objectives list
		var buildHtml = "<Table><tr><td>Initiative<wbr ></wbr>(number here)</td><td> and (statement)</td></tr>";				
		var LastTwocurrentYear = 13;
		$(xData.responseXML).find(<wbr ></wbr>"z\\:row")<wbr ></wbr>.each(func<wbr ></wbr>tion() 
		{  
			//This decides how many input boxes to provide
			var ReportingFrequency = $(this).attr("ows_Reportin<wbr ></wbr>gFrequency<wbr ></wbr>")

			$("#initiative").append("<<wbr ></wbr>tr><td>(in<wbr ></wbr>itiative measure)</td><td> and statement</td></tr><tr><td<wbr ></wbr>>Frequency<wbr ></wbr> of Calculation:</td><td></td><wbr ></wbr></tr><tr><<wbr ></wbr>td colspan='2'>Please provide 'Current Result' for each quarter of each Fiscal Year.</td></tr>");
			if (ReportingFrequency=="Quar<wbr ></wbr>terly")
			{
				var qtrInput = 4;
				$("#initiative").append("<<wbr ></wbr>tr><td colspan='2'>FY"+currentYea<wbr ></wbr>r);
	
				for(var i = 0; i < qtrInput; i++)
				{
		
					//$("#initiative").append(<wbr ></wbr>"Qtr "+i": <input id='CurrentResultFY"+LastT<wbr ></wbr>wocurrentY<wbr ></wbr>ear+" type='text' style='width:150px;' /></td></tr>");
					$("#initiative").append("Q<wbr ></wbr>tr 1 <input type='text' style='width:150px' />");
					LastTwocurrentYear++;	
					
				}
				$("#initiative").append("<<wbr ></wbr>/td></tr>"<wbr ></wbr>);
			}
		
		});
	}

Open in new window

0
Comment
Question by:Isaac
  • 3
4 Comments
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39167347
Hi,
your code looks a little scrambled, can you try this:
function GetCurrentResult(xData, status) {
	var currentYear = (new Date).getFullYear();
	//alert(xData.responseXML.<wbr ></wbr>xml);
	//Iterates through each row and returns information - Populates the "Performer" dropdown with values from the Objectives list
	var buildHtml = "<table><tr><td>Initiative (number here)</td><td> and (statement)</td></tr>";				
	var LastTwocurrentYear = 13;
	$(xData.responseXML).find("z\\:row").each(function() {  
		//This decides how many input boxes to provide
		var ReportingFrequency = $(this).attr("ows_ReportingFrequency");
		$("#initiative").append("<tr><td>(initiative measure)</td><td> and statement</td></tr><tr><td>Frequency of Calculation:</td><td></td></tr><tr><td colspan='2'>Please provide 'Current Result' for each quarter of each Fiscal Year.</td></tr>");
		if (ReportingFrequency=="Quarterly")
		{
			var qtrInput = 4;
			$("#initiative").append("<tr><td colspan='2'>FY"+currentYear);
			for(var i = 0; i < qtrInput; i++)
			{
				//$("#initiative").append(<wbr ></wbr>"Qtr "+i": <input id='CurrentResultFY"+LastT<wbr ></wbr>wocurrentY<wbr ></wbr>ear+" type='text' style='width:150px;' /></td></tr>");
				$("#initiative").append("Qtr 1 <input type='text' style='width:150px' />");
				LastTwocurrentYear++;
			}
			$("#initiative").append("</td></tr>");
		}
	});
}

Open in new window


Can you perhaps attach the xData.responseXml to be able to test the generated output?

The variable buildHtml is not used at all.
It would also be nice to have the surrounding HTML e.g. the initial content of #initiative.

HTH
Rainer
0
 
LVL 5

Author Comment

by:Isaac
ID: 39169485
Hi Rainer,

I still don't get anything with the modified code you provided.

Also, I could not append the xData to a div, so I provided an image below.
<table id="initiative" border="1" width="65%">
<tr>
	<td></td>
</tr>
</table>

<Div id="xData"></div>
<script type="text/javascript" src="../js/jquery-1.8.2.min.js" language="javascript"></script>
<script type="text/javascript" src="../js/jquery.SPServices-0.7.2.min.js" language="javascript"></script>
<script type="text/javascript" src="../js/jquery-ui-LatestVersion.js" language="javascript"></script>

<script type="text/javascript">
$(document).ready(function() {
currSiteUrl = $().SPServices.SPGetCurrentSite();
 
var soapEnv3 =
        "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>" +
            "<soapenv:Body>" +
                "<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>" +
                    "<listName>Objective Level Performance Measures</listName>" +
					"<query><Query><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>1.1.1M</Value></Eq></Where></Query></query>" +
                    "<viewFields>" +
                        "<ViewFields>" +
                        "</ViewFields>" +
                    "</viewFields>" +
                "</GetListItems>" +
            "</soapenv:Body>" +
        "</soapenv:Envelope>";
        $.ajax(
	{
	    url: currSiteUrl + "/_vti_bin/lists.asmx",
	    async: true,
	    type: "POST",
	    dataType: "xml",
	    data: soapEnv3,
	    complete: GetCurrentResult,
	    contentType: "text/xml; charset=\"utf-8\""
	});	
});


	function GetCurrentResult(xData, status) {
	var currentYear = (new Date).getFullYear();
	alert(xData.responseXML.xml);
	$("#xData").append(xData);
	//Iterates through each row and returns information - Populates the "Performer" dropdown with values from the Objectives list
	var buildHtml = "<table><tr><td>Initiative (number here)</td><td> and (statement)</td></tr>";				
	var LastTwocurrentYear = 13;
	$(xData.responseXML).find("z\\:row").each(function() {  
		//This decides how many input boxes to provide
		var ReportingFrequency = $(this).attr("ows_ReportingFrequency");
		$("#initiative").append("<tr><td>(initiative measure)</td><td> and statement</td></tr><tr><td>Frequency of Calculation:</td><td></td></tr><tr><td colspan='2'>Please provide 'Current Result' for each quarter of each Fiscal Year.</td></tr>");
		if (ReportingFrequency=="Quarterly")
		{
			var qtrInput = 4;
			$("#initiative").append("<tr><td colspan='2'>FY"+currentYear);
			for(var i = 0; i < qtrInput; i++)
			{			
				$("#initiative").append("Qtr 1 <input type='text' style='width:150px' />");
				LastTwocurrentYear++;
			}
			$("#initiative").append("</td></tr>");
		}
	});
	}
</script>

Open in new window


xData Data:

xData
0
 
LVL 5

Accepted Solution

by:
Isaac earned 0 total points
ID: 39171097
function GetCurrentResult(xData, status) {
	var currentYear = (new Date).getFullYear();
	alert(xData.responseXML.xml);
	$("#xData").append(xData);
	//Iterates through each row and returns information - Populates the "Performer" dropdown with values from the Objectives list

	$(xData.responseXML).find("z\\:row").each(function() {  
		//This decides how many input boxes to provide
		var ReportingFrequency = $(this).attr("ows_ReportingFrequency");
		$("#initiative").append("<tr><td>(initiative measure)</td><td> and statement</td></tr><tr><td>Frequency of Calculation:</td><td></td></tr><tr><td colspan='2'>Please provide 'Current Result' for each quarter of each Fiscal Year.</td></tr>");
		if (ReportingFrequency=="Quarterly")
		{
			var qtrInput = 4;
			var nextYear = currentYear+1;
			currentResultYear(qtrInput,currentYear);
			currentResultYear(qtrInput,nextYear);
		}
	});
	}
	
	function currentResultYear(qtrInput,Year)
	{
			var j=1;
			
			for(var i = 0; i < qtrInput; i++)
			{							
				$("#initiative").append("<tr><td colspan='2'>FY"+Year+" Qtr"+j+"<input type='text' value='' name='CurrentResultFY13' /></td></tr>");
				//CurrentResultFY13Qtr1
				j++;
			}
	}

Open in new window

0
 
LVL 5

Author Closing Comment

by:Isaac
ID: 39183768
Issue resolved
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

773 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