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

x
?
Solved

Checkbox and dropdown list in HTML Cell

Posted on 2010-08-26
7
Medium Priority
?
808 Views
Last Modified: 2012-05-10
Hi,

I'd like to know if I could design a data grid like this with preloaded values in the dropdown list
Here is what I'd like to develop:
http://linux.softpedia.com/screenshots/phpMyAdmin_2.png
0
Comment
Question by:DoofuS
[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
  • 4
  • 2
7 Comments
 
LVL 1

Expert Comment

by:THBA
ID: 33536267
You could use ASP.NET. To do this with pure HTML and Javascripts (or VBScript) is possible.
0
 

Author Comment

by:DoofuS
ID: 33538571
cant use asp.net... first off, I am not at all versed.  I'm not sure if you wanted to say it is IMPOSSIBLE to do it in plain HTML?
0
 
LVL 5

Expert Comment

by:wmadrid1
ID: 33539884
hi,
It's totally possible, on phpmyadmin that's done on HTML + Javascript

finally .NET just help us with the javascript alredy incorpored on the controls.

In the past i developed something like it, i can pass you the code because it have copyright, but i can tell you how a did the part of the preloaded dropdown list

First i had a hidden div (divlist) which was filled with the data.
After the table with the data
Each row had his td columns, and in the dropdown list column, for each row, i had a div (divrow) just with the actual text and a hidden input with the value.

So when the row was clicked, a javascript function is called and on this,
the innerHTML of divrow is set with the divlist innerHTML, and the selectedIndex set to the value of hidden input.

This is the basic you ant to do, you must have in mind other things
such as when another row is clicked so then the prev row must save the data with AJAX and the divrow set again with the selected text


0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:DoofuS
ID: 33555141
wmadrid,

Can you please help me with a sample code? Like just for row of the table? I am very new to this but since you said it is possible to do it with HTML and Javascript, I would build on the sample code.
0
 
LVL 5

Accepted Solution

by:
wmadrid1 earned 2000 total points
ID: 33555683
DoofuS,

The code below, just assign the listbox and assing the value of it for each table row
It was tested with Mozilla Firefox 3.6.8, with IE maybe need come little changes

That's a good begin
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
<div id="combo" style="display:none; ">
<select name="list">
	<option value="1">Perez</option>
	<option value="2">Narvaez</option>
	<option value="3">Madrid</option>
	<option value="4">Other</option>
</select>
</div>

<form name="f">
<table border="1">
	<tr id="tr1" onDblClick="foco(1)">
		<td>
		Juan
		</td>
		<td>
		<input type="hidden" name="tr1_value" value="1">
		<div id="div1">Perez</div>
		</td>
	</tr>
	<tr id="tr2" onDblClick="foco(2)">
		<td>
		Jose
		</td>
		<td>
		<input type="hidden" name="tr2_value" value="2">
		<div id="div2">Narvaez</div>
		</td>
	</tr>
	<tr id="tr3" onDblClick="foco(3)">
		<td>
		Adrian
		</td>
		<td>
		<input type="hidden" name="tr3_value" value="3">
		<div id="div3">Madrid</div>
		</td>
	</tr>
</table>
</form>
<script>
function foco(id)
{
	var divC = document.getElementById("combo");
	var div = document.getElementById("div"+id);
	div.innerHTML = divC.innerHTML;
	var value = document.f.elements["tr"+id+"_value"].value;
	//Assing the value of listbox to the hidden value
	//This can change with IE
	div.childNodes[1].value = value;
}
</script>
</body>
</html>

Open in new window

0
 

Author Comment

by:DoofuS
ID: 33558591
Thank you so much. I am looking in to it and will report.
0
 

Author Closing Comment

by:DoofuS
ID: 33656591
Thanks wmadrid1 and my apologies for a delayed response!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
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…

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