[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Pre-populate Element

Posted on 2013-06-29
2
Medium Priority
?
280 Views
Last Modified: 2013-07-16
Hi All,

I have a form that is populated from a list.  Here is a piece of the form:
form
If the AOT Designator is "Yes", the "CompletionDate" and "showCompletionDatelabel" are supposed to display but they are not.

Here is an excerpt of the code:

					<tr>
									<td style="width: 313px;font-weight:bold" class="bgColor">AOT Designator</td>
									<td class="bgColorElement">
										<select name="AotDesignator" id="drpdAotDesignator">
											<option value=""></option>
											<option value="Yes">Yes</option>
											<option value="No">No</option>
										</select>
									</td>
					</tr>					
					
					<tr>
									<td style="width: 313px;font-weight:bold" class="bgColor"><span style="display:none" id="showCompletionDatelabel">
									Completion Date</span></td>
									<td class="bgColorElement">
									<span style="display:none" id="showCompletionDate">
										<input type="text" name="txtCompletionDate" id="CompletionDate">
									</span>
									</td>
					</tr>



$(xData.responseXML).find("z\\:row").each(function() 
	{  
        var Designator = $(this).attr("ows_AOTDesignator");
		$("#drpdAotDesignator").val(Designator);
		alert(Designator);
		if(Designator == "Yes")
		{
			alert("Yes Again");
			$("#showCompletionDate").css("display", "block");
			$("#showCompletionDatelabel").css("display", "block");			
		}
	}

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
2 Comments
 
LVL 15

Assisted Solution

by:Jagadishwor Dulal
Jagadishwor Dulal earned 1000 total points
ID: 39287776
I have slightly changed your table see the function you may add it in your existing
<script>
$(document).ready(function() {
$('#drpdAotDesignator').change(function(){
var Designator=$('#drpdAotDesignator').val();
		if(Designator =='Yes'){
			alert("Yes Again");
			$("#showCompletionDate").css("display", "block");
		}
	})
});
</script>                                  

Open in new window


And the table html is:
<tr>
									<td style="width: 313px;font-weight:bold" class="bgColor">AOT Designator</td>
									<td class="bgColorElement">
										<select name="AotDesignator" id="drpdAotDesignator">
											<option value=""></option>
											<option value="Yes">Yes</option>
											<option value="No">No</option>
										</select>
									</td>
					</tr>					
					
					<tr id="showCompletionDate" style="display:none">
									<td class="bgColor">
                                  
									Completion Date</td>
									<td class="bgColorElement">
										<input type="text" name="txtCompletionDate" id="CompletionDate">
									</td>
					</tr>

Open in new window

0
 
LVL 4

Accepted Solution

by:
ramyajanarthanan earned 1000 total points
ID: 39289719
Alternatively,You can use show() or hide() too...

$("#showCompletionDate").show();

You can similarly code for any number of div or tables,list items etc.,to show and hide based on the conditions.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn how to dynamically set the form action using jQuery.
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…

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