[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

jquery text boxes not rendering

Posted on 2013-05-14
4
Medium Priority
?
243 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

656 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