By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,812 Members | 863 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,812 IT Pros & Developers. It's quick & easy.

retrieve clean text between <td></td>

P: n/a
js
I have a table rendered with XSLT. The first column has a radio
button controls for user to make a selection for a particular row.
All the values in the remaining columns are all concated with a &#xA0;
(blank). I need to retieve the text in each cell of that row if the
radio button on that row is clicked. Each <TD> has a numeric ID so
that I can use it with document.getElementById().innerText method. I
use Javascript to assign some hidden fields with these innerText
before the form is submitted. Upon submission, the form would contain
those values along with %90?. How can I get rid of those HTML encoded
string and get only the text that appear in the browser using
javascript? I am using IE6. I also need to have it working in Opera
and Netscape. Thanks.
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
an********@yahoo.com (js) wrote in message news:<23**************************@posting.google. com>...
I have a table rendered with XSLT. The first column has a radio
button controls for user to make a selection for a particular row.
All the values in the remaining columns are all concated with a &#xA0;
(blank). I need to retieve the text in each cell of that row if the
radio button on that row is clicked. Each <TD> has a numeric ID so
that I can use it with document.getElementById().innerText method. I
use Javascript to assign some hidden fields with these innerText
before the form is submitted. Upon submission, the form would contain
those values along with %90?. How can I get rid of those HTML encoded
string and get only the text that appear in the browser using
javascript? I am using IE6. I also need to have it working in Opera
and Netscape. Thanks.


Can you post examples of the string you have and how
you'd like it to look afterwards? You can probably
do this pretty simply with a regular expression.

Shawn
Jul 23 '05 #2

P: n/a
Thanks for the reply. The following is the XSLT template that render the
table content, and Javascript that manipulate the values of the hidden
fields before submit. Thank you.

function fillTechRefreshForm()
{
var taskid = document.getElementById('txtTaskId').value;
if (taskid == "")
{
alert("Please select task id by clicking the radio button")
return false;
}
else
{
with (document.forms[0])
{
txtTaskId.value = document.getElementById('td' + taskid.toString() +
'1').innerText;
txtLastName.value = document.getElementById('td' + taskid.toString()
+ '9').innerText;
txtFirstName.value = document.getElementById('td' +
taskid.toString() + '10').innerText;
//cboUserName.value = document.getElementById('td' +
taskid.toString() + '2').innerText;
cboUserName.value = txtLastName.value + ", " + txtFirstName.value;
cboSerial.value = document.getElementById('td' + taskid.toString() +
'3').innerText;
txtScheduled.value = document.getElementById('td' +
taskid.toString() + '4').innerText;
txtReady.value = document.getElementById('td' + taskid.toString() +
'5').innerText;
txtDeployed.value = document.getElementById('td' + taskid.toString()
+ '6').innerText;
txtNewSystem.value = document.getElementById('td' +
taskid.toString() + '7').innerText;
txtComments.value = document.getElementById('td' + taskid.toString()
+ '8').innerText;
submit();
}
}
}

<!----XSLT---->
<xsl:when test="xyz/return/techrefreshs">
<xsl:if test="xyz/return/techrefreshs/recordcount = 0">
<div id="warning">No record match the criteria.</div>
</xsl:if>
<xsl:if test="xyz/return/techrefreshs/recordcount &gt; 0">
<form action="techRefresh.asp" method="post"
onsubmit="return(fillTechRefreshForm())">
<table class="inventoryTable" cellpadding="0" cellspacing="0">
<tr>
<th>&#xA0;</th>
<th><!--checkbox-->&#xA0;</th>
<th><a href="javascript:changeSort('org')" title="Order by
ORG">TASK ID</a></th>
<th><a href="javascript:changeSort('ticketnum')" title="Order by
user#">USER</a></th>
<th><a href="javascript:changeSort('ticketnum')" title="Order by
last name#">LAST NAME</a></th>
<th><a href="javascript:changeSort('ticketnum')" title="Order by
first name">FIRST NAME</a></th>
<th><a href="javascript:changeSort('c_last_name')" title="Order
by serial number">SERIAL</a></th>
<th><a href="javascript:changeSort('c_first_name')" title="Order
by scheduled date">SCHEDULED</a></th>
<th><a href="javascript:changeSort('type')" title="Order by ready
date">READY</a></th>
<th><a href="javascript:changeSort('status')" title="Order by
deployed date">DEPLOYED</a></th>
<th><a href="javascript:changeSort('open_date')" title="Order by
system">NEW<br/>SYSTEM</a></th>
<th>COMMENTS</th>
</tr>
<xsl:apply-templates
select="xyz/return/techrefreshs/techrefresh"/>
</table>
<input type="hidden" id="txtTaskId" name="txtTaskId"/>
<input type="hidden" id="cboUserName" name="cboUserName"/>
<input type="hidden" id="txtLastName" name="txtLastName"/>
<input type="hidden" id="txtFirstName" name="txtFirstName"/>
<input type="hidden" id="cboSerial" name="cboSerial"/>
<input type="hidden" id="txtScheduled" name="txtScheduled"/>
<input type="hidden" id="txtReady" name="txtReady"/>
<input type="hidden" id="txtDeployed" name="txtDeployed"/>
<input type="hidden" id="txtNewSystem" name="txtNewSystem"/>
<input type="hidden" id="txtComments" name="txtComments"/>
<input type="submit" id="btnAction" name="btnAction" value="Confirm
Selection"/>
</form>
</xsl:if>
</xsl:when>

<xsl:template match="techrefresh">
<xsl:variable name="rowNumber" select="position()" />
<xsl:variable name="taskid" select="taskid"/>
<tr>
<td style="color:#CCC;background-color:#003366"><xsl:value-of
select="$rowNumber"/></td>
<td align="center">
<input type="radio" id="rdoSelectedTask" name="rdoSelectedTask">
<xsl:attribute name="value"><xsl:value-of
select="$taskid"/></xsl:attribute>
<xsl:attribute
name="onclick">document.getElementById("txtTaskId" ).value=<xsl:value-of
select="$taskid"/></xsl:attribute>
</input>
</td>
<td align="center">
<xsl:attribute name="id">td<xsl:value-of
select="$taskid"/>1</xsl:attribute>
<xsl:value-of select="$taskid"/>
</td>
<td>
<xsl:attribute name="id">td<xsl:value-of
select="$taskid"/>2</xsl:attribute>
<xsl:value-of select="userlogin"/>&#xA0;
</td>
<td>
<xsl:attribute name="id">td<xsl:value-of
select="$taskid"/>9</xsl:attribute>
<xsl:value-of select="lastname"/>&#xA0;
</td>
<td>
<xsl:attribute name="id">td<xsl:value-of
select="$taskid"/>10</xsl:attribute>
<xsl:value-of select="firstname"/>&#xA0;
</td>
<td>
<xsl:attribute name="id">td<xsl:value-of
select="$taskid"/>3</xsl:attribute>
<xsl:value-of select="serial"/>&#xA0;
</td>
<td>
<xsl:attribute name="id">td<xsl:value-of
select="$taskid"/>4</xsl:attribute>
<xsl:value-of select="scheduled"/>&#xA0;
</td>
<td>
<xsl:attribute name="id">td<xsl:value-of
select="$taskid"/>5</xsl:attribute>
<xsl:value-of select="systemready"/>&#xA0;
</td>
<td>
<xsl:attribute name="id">td<xsl:value-of
select="$taskid"/>6</xsl:attribute>
<xsl:value-of select="systemdeployed"/>&#xA0;
</td>
<td>
<xsl:attribute name="id">td<xsl:value-of
select="$taskid"/>7</xsl:attribute>
<xsl:value-of select="newsystem"/>&#xA0;
</td>
<td>
<xsl:attribute name="id">td<xsl:value-of
select="$taskid"/>8</xsl:attribute>
<xsl:value-of select="comments"/>&#xA0;
</td>
</tr>
</xsl:template>


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.