Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need some help with textfield, select menu and checkbox interaction.

Posted on 2010-09-08
7
Medium Priority
?
396 Views
Last Modified: 2012-05-10
Everything is explained in the code window.

Thank you,

Brian
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<label>
		<input type="checkbox" name="checkbox" id="checkbox" />
</label>
If Checkbox is checked then the B field will automatically EQ the A field value and so on with C and D and E and F. Fields B, D and F will also be &quot;disabled&quot;. If the checkbox is unchecked then the values will remain the same but editable again.<br />
<br />
<br />
<table width="0" border="0" cellspacing="0" cellpadding="0">
		<tr>
				<td colspan="2"><label>
						A Field
										<input type="text" name="textfield" id="textfield" value="First Name" /> 
						B Field
				</label></td>
				<td width="155"><input type="text" name="textfield2" id="textfield2" /></td>
		</tr>
		<tr>
				<td colspan="2"><label> C Field
								<input type="text" name="textfield3" id="textfield3" value="First Name" />
						D Field </label></td>
				<td><input type="text" name="textfield3" id="textfield4" /></td>
		</tr>
		<tr>
				<td width="193">E Field 
						<label>
								<select name="select" id="select">
										<option value="1">A</option>
										<option value="2">B</option>
								</select>
				</label></td>
				<td width="118"> F Field</td>
				<td><select name="select2" id="select2">
						<option value="1">A</option>
						<option value="2">B</option>
				</select></td>
		</tr>
</table>

</body>
</html>

Open in new window

0
Comment
Question by:brihol44
[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
7 Comments
 
LVL 5

Expert Comment

by:drakeshe
ID: 33633762
Need more input please...
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 33633771
<<B field will automatically EQ the A field value >>
what does this means?
0
 
LVL 5

Expert Comment

by:drakeshe
ID: 33633792
Are you familiar with javascript or jquery?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 13

Accepted Solution

by:
ansudhindra earned 1800 total points
ID: 33633796
Hi, try th following code, let me know in case of ny thing neede....
test1.html
0
 
LVL 40

Assisted Solution

by:Gurvinder Pal Singh
Gurvinder Pal Singh earned 200 total points
ID: 33633833
try this code as well (assuming EQ means Equal :))
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
   function enableAndCopy(thisObj)
   {
      if ( thisObj.checked )
	  {
		document.getElementById("textfield2").disabled = true;
		document.getElementById("textfield2").value = document.getElementById("textfield1").value;
		document.getElementById("textfield4").disabled = true;
		document.getElementById("textfield2").disabled = document.getElementById("textfield3").value;
		document.getElementById("select2").disabled = true;
		document.getElementById("select2").value = document.getElementById("select1").value;
	  }
	  else
	  {
		document.getElementById("textfield2").disabled = false;
		document.getElementById("textfield4").disabled = false;
		document.getElementById("select2").disabled = false;
	  }
   }
</script>
</head>

<body>
<label>
		<input type="checkbox" name="checkbox" id="checkbox" onclick="enableAndCopy(this)"/>
</label>
If Checkbox is checked then the B field will automatically EQ the A field value and so on with C and D and E and F. Fields B, D and F will also be &quot;disabled&quot;. If the checkbox is unchecked then the values will remain the same but editable again.<br />
<br />
<br />
<table width="0" border="0" cellspacing="0" cellpadding="0">
		<tr>
				<td colspan="2"><label>
						A Field
										<input type="text" name="textfield" id="textfield" value="First Name" /> 
						B Field
				</label></td>
				<td width="155"><input type="text" name="textfield2" id="textfield2"  /></td>
		</tr>
		<tr>
				<td colspan="2"><label> C Field
								<input type="text" name="textfield3" id="textfield3" value="First Name" />
						D Field </label></td>
				<td><input type="text" name="textfield3" id="textfield4" /></td>
		</tr>
		<tr>
				<td width="193">E Field 
						<label>
								<select name="select" id="select">
										<option value="1">A</option>
										<option value="2">B</option>
								</select>
				</label></td>
				<td width="118"> F Field</td>
				<td><select name="select2" id="select2" >
						<option value="1">A</option>
						<option value="2">B</option>
				</select></td>
		</tr>
</table>

</body>
</html>

Open in new window

0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 33633844
Sorry, small change
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Untitled Document</title>
	<script>
	   function enableAndCopy(thisObj)
	   {
		  if ( thisObj.checked )
		  {
			document.getElementById("textfield2").value = document.getElementById("textfield").value;
			document.getElementById("textfield2").disabled = true;
			document.getElementById("textfield4").value = document.getElementById("textfield3").value;
			document.getElementById("textfield4").disabled = true;
			document.getElementById("select2").value = document.getElementById("select1").value;
			document.getElementById("select2").disabled = true;
		  }
		  else
		  {
			document.getElementById("textfield2").disabled = false;
			document.getElementById("textfield4").disabled = false;
			document.getElementById("select2").disabled = false;
		  }
	   }
	</script>
	</head>

	<body>
	<label>
			<input type="checkbox" name="checkbox" id="checkbox" onclick="enableAndCopy(this)"/>
	</label>
	If Checkbox is checked then the B field will automatically EQ the A field value and so on with C and D and E and F. Fields B, D and F will also be &quot;disabled&quot;. If the checkbox is unchecked then the values will remain the same but editable again.<br />
	<br />
	<br />
	<table width="0" border="0" cellspacing="0" cellpadding="0">
			<tr>
					<td colspan="2"><label>
							A Field
											<input type="text" name="textfield" id="textfield" value="First Name" /> 
							B Field
					</label></td>
					<td width="155"><input type="text" name="textfield2" id="textfield2"  /></td>
			</tr>
			<tr>
					<td colspan="2"><label> C Field
									<input type="text" name="textfield3" id="textfield3" value="First Name" />
							D Field </label></td>
					<td><input type="text" name="textfield3" id="textfield4" /></td>
			</tr>
			<tr>
					<td width="193">E Field 
							<label>
									<select name="select" id="select">
											<option value="1">A</option>
											<option value="2">B</option>
									</select>
					</label></td>
					<td width="118"> F Field</td>
					<td><select name="select2" id="select2" >
							<option value="1">A</option>
							<option value="2">B</option>
					</select></td>
			</tr>
	</table>

	</body>
	</html>

Open in new window

0
 

Author Closing Comment

by:brihol44
ID: 33633920
Perfect! Thanks ansudhindra! gurvinder372 the select menu wasn't working as the same as the other textfields... just FYI... but almost working correctly.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn how to dynamically set the form action using jQuery.
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)
Suggested Courses

636 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