Solved

jquery text boxes not rendering

Posted on 2013-05-14
4
236 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Find out what you should include to make the best professional email signature for your organization.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
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…

789 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