PDA

View Full Version : Binding Data to a Checkbox within a Table


nostrander
08-17-2006, 04:52 PM
I am workng on binding data to bind the "true" or "false" value in a xml document to the checked value for a checkbox. The check box is located with in a table.

here is what I have done:
<table width="400" align="center">
<tr>
<td width="100">Drama</td>
<td><input type="checkbox" datasrc="#Stud_Info" datafld="Drama"></td>
<td width="100">Football</td>
<td><input type="checkbox" datasrc="#Stud_Info" datafld="Football"></td>
</tr>

I have tried setting the datasrc of the table to the necessary datsrc and the datafld to the parent for the child elements as in the code below but doing it in this manner doesn't seem to work. Is there something I'm missing on the second example or is the first example the correct way to do this.
Thanks :confused:

<table width="400" align="center" datasrc="#Stud_Info" datafld="Student">
<tr>
<td width="100">Drama</td>
<td><input type="checkbox" datafld="Drama"></td>
<td width="100">Football</td>
<td><input type="checkbox" datafld="Football"></td>
</tr>

Alex Vincent
08-17-2006, 05:21 PM
All I can say is this sounds very Microsoftian. The datafld and datasrc attributes are not part of the HTML 4 Recommendation from the World Wide Web Consortium, and are almost certainly not supported in Firefox, Opera, etc.

DELOCH
08-19-2006, 02:53 AM
uhh... w3school teaches this is the only way to make a data island thus it is a good thing for people that are unable to connect to db due to client-side inability.

Alex Vincent
08-19-2006, 06:27 AM
Ah, data islands. A Microsoft-only extension.

What're you testing this on? (Sorry no one else has jumped in to help, and I don't have enough knowledge about data islands to be useful, either.)

ealbrecht
08-21-2006, 05:57 PM
If all you're needing to do is read/write to the xml database then you can use xsl to display the xml in html format and your server langauge (php, asp, etc...) to write the data back to the xml database. This is a good fast crossbrowser method. Alex is right in that data islands are a Microsoft only solution. If however you need added special functionality when displaying your xml data to the page, then in order to get a crossbrowser solution you'll need to create your own xml/xsl processors to translate the xml data. But, that really depends on what you're all trying to do, and in most cases you can just get away with using a xsl & xml combo.