473,461 Members | 1,947 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

retrieve clean text between <td></td>

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
2 11176
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Terry | last post by:
hi guys, could anyone help me with this? I tried to put a <div> in a <td>, and a <table> in that <div>. It looks fine, but my div can't fit in my <td>, there's always a space between the bottom of...
6
by: Mel | last post by:
is it possible ? i tried size=100% and 'NADA !' thanks, Mel
3
by: Matt Adams | last post by:
I want to move the following <PRE> defintion to a css file: <TABLE><TR><TD><PRE>sample text</PRE></TD> <TD> not predefined font</TD></TR></TABLE> should be <TABLE><TR><TD class=aaa>sample...
3
by: webserverpete | last post by:
I would like to have multiple <td> in a repeater control. The below code does not work: <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" DataMember="DefaultView">...
1
by: prefersgolfing | last post by:
I'm not using Master Pages, yet I'd like to display the contents of an HTML page within a <table><tr><td> on a .aspx. I have a lengthy guide already paginated in html. I'd like to embed the...
4
George Lft
by: George Lft | last post by:
I'm new at building table. Mostly PHP programming . Now I can't seem to fix the size of my table row and column. Any idea? <h4>Two rows and three columns:</h4> <table border="1"> <tr> ...
7
by: Xiaoyan | last post by:
Hi,everyone: I have a problem now. I can't get the information between the <tr><td> and </td></tr>. for example: I use this regular expression can't get it, I don't know why....
2
by: jessy | last post by:
I have a table at which i need to add fields in it whenever the user clicks on the Add button , here's my trial but seems sth is wrong : function AddTool() { formdiv =...
0
by: =?Utf-8?B?R3JlZw==?= | last post by:
I've created my table and alli is fine. I name my <tdtags to make them easier to identify when my table gets large. Anyway, I am naming as such: <td id="cellName" > Now, sometimes when make a...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.