473,408 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

nowrap inline validation msgs in tbl

I'm trying to make the most of my validation routine, and print out
user friendly messages. I've got a nice writeToDiv function and I'm
trying to make the messages look good (not wrap around).

Typically any dynamic use of writeToDiv, has given me an extra line and
I'd like it to appear directly to the right of the I.fld

I've tried to specify enough width for the <td> and even have a
separate column for the <div>, but neither turned out ideal.

Seems like this should be easy, but if I need to I'll design something
that works with absolute positioning and ?zorder?
Need a little Help !

Jul 23 '05 #1
4 1524
in*****@rcn.com said the following on 7/22/2005 3:19 PM:
I'm trying to make the most of my validation routine, and print out
user friendly messages. I've got a nice writeToDiv function and I'm
trying to make the messages look good (not wrap around).

Typically any dynamic use of writeToDiv, has given me an extra line and
I'd like it to appear directly to the right of the I.fld

I've tried to specify enough width for the <td> and even have a
separate column for the <div>, but neither turned out ideal.

Seems like this should be easy, but if I need to I'll design something
that works with absolute positioning and ?zorder?
Need a little Help !


Excuse me while I hunt my mind-reading cap. I need it in order to see
the function writeToDiv. But why roll your own when DynWrite is in this
groups FAQ and doesn't add line breaks?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2
I thinks its a table issue, not something inherent in the javascript
code, but here goes:
function writeToDiv(div, str)
{
if(document.all) {
document.all(div).innerHTML=str;
} // IE4 NS5
else if(document.getElementById) {
document.getElementById(div).innerHTML=str;} // IE5 NS6
else if(document.layers) {
with (document.div.document)
{ open();
write(str); // NN4
close();
}
}

Table Row example (one option)
<tr>
<td width="30%">Name:</td>
<td width="70%"><input type="text" name="name" size="10" maxlength="10"

<div d="ename">&nbsp</div></td>
</tr>

Jul 23 '05 #3
in*****@rcn.com wrote:
I thinks its a table issue, not something inherent in the javascript
code, but here goes:

Please quote what you are replying to. Your problem has nothing to do
with JavaScript, however improvement is always possible. :-)

function writeToDiv(div, str)
{
if(document.all) {
document.all(div).innerHTML=str;
} // IE4 NS5
else if(document.getElementById) {
document.getElementById(div).innerHTML=str;} // IE5 NS6
else if(document.layers) {
with (document.div.document)
{ open();
write(str); // NN4
close();
}
}
You should test for getElementById first, it is likely more widely
supported that document.all (or soon will be) so test for it first:

if(document.getElementById)
{
document.getElementById(div).innerHTML=str;
}
else if(document.all)
{
document.all(div).innerHTML=str;
}
else if(document.layers)
{
/...

Have a look at the group FAQ for a variety of ways to implement the above.

Table Row example (one option)
<tr>
<td width="30%">Name:</td>
<td width="70%"><input type="text" name="name" size="10" maxlength="10"

<div d="ename">&nbsp</div></td>


A div is a block level element and so will appear on a line by itself
unless you make it do something else. Use an inline element (say a
span) and you get the result you are after if you heed the following.

Your attempt at TD sizing fails (comp.infosystems.www.authoring.html
will help there) so your new text is forced to wrap - percentages are
always messy. Fixed-size columns are bad, so use CSS and em or ex or
similar that will scale with the font size and you are happy again.

I think there was a brace missing from your script, and you have a
typo - there is no 'd' attribute for a div, I think you meant 'id'. ;-p

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head><title>Show random matrix</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<style type="text/css">
..nameCol { width: 6em; }
..entryCol { width: 20em; }
</style>

<script type="text/javascript">
function writeToDiv( div, str) {

if ( document.getElementById ) {
document.getElementById( div ).innerHTML=str;
} else if( document.all ) {
document.all[ div ].innerHTML=str;
} else if( document.layers ) {
with ( document.div.document ) {
open();
write(str); // NN4
close();
}
}
}

</script>
</head>
<body>
Table Row example (one option)

<table border="1">
<tr>
<td class="nameCol">Name:</td>
<td class="entryCol"><input type="text" name="input1"
size="10" maxlength="10" onchange="
writeToDiv( 'ename', this.value );
"><span id="ename">&nbsp</span></td>
</tr>
</table>

</body></html>


--
Rob
Jul 23 '05 #4
in*****@rcn.com wrote:
I'm trying to make the most of my validation routine, and print out
user friendly messages. I've got a nice writeToDiv function and I'm
trying to make the messages look good (not wrap around).

Typically any dynamic use of writeToDiv, has given me an extra line and
I'd like it to appear directly to the right of the I.fld

I've tried to specify enough width for the <td> and even have a
separate column for the <div>, but neither turned out ideal.

Seems like this should be easy, but if I need to I'll design something
that works with absolute positioning and ?zorder?
Need a little Help !


Try using a <span> instead of a <div>.

<div> is a block-level element, so wants to be on its own line.
You can fix this with CSS display: inline;, or just use a <span>. I
recommend <span>.

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Richard Payne | last post by:
I am developing a web application that utilises multiple grids, panels, validation controls etc on the same page. I have added the appropriate code to pop up dialogs to confirm delete in...
0
by: Mark Moore | last post by:
I'm trying to layout a couple text input fields and their corresponding labels without using a table. When I was trying to debug my understanding of CSS, I was *very* surprised to see that span's...
3
by: Robert Cerny | last post by:
Hi everybody, I encounter the following layout problem in IE 6.0.28: Even on specifying "white-space: nowrap" and "overflow: hidden" the paragraph shoots out over the boundaries of the width...
0
by: Libs | last post by:
I have a custom validator that validates a numeric field, txtField, that allows for thousand separators. I also placed a validation summary so that it would display the error msgs of all my...
2
by: Nathan Sokalski | last post by:
I want to create TD tags with the nowrap property. I have a user control which sets the Wrap property of a TableCell to False when dynamically creating a table as follows: cellCurrButton.Wrap =...
10
by: John Richardson | last post by:
General question about how WinForms handles undoing a change during a control's validation, if it does at all. After a change to a control's value, if the data is determined to be invalid, then in...
37
by: Prisoner at War | last post by:
Actually, it doesn't have to be a blockquote...but I'm at my wits' end: I want to make bold several lines of text which have a pair of <br /tags between them...seems like the <b></bdo not "carry...
3
pradeepjain
by: pradeepjain | last post by:
I am using a form which does inline validation using jquery! http://yensdesign.com/2009/01/how-validate-forms-both-sides-using-php-jquery/ and i saw another inline validation method ...
0
by: anand4160 | last post by:
i use nowrap="nowrap" attribuate to fix my UI for IE 6 , now when i am trying to run the same code in IE 8 its not working. The code is simple to display table. nowrap="nowrap" is written in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.