Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate table data with value from form field. 1

Status
Not open for further replies.

reisende

Programmer
Mar 16, 2004
74
US
Hi everyone.

I had a question regarding a preview feature I would like to implement on our intranet site.

I want to provide a preview of employee name tags that can be ordered online and I would like to do so using form fields for entering employee name and title and then have them click a button to preview their name tag.

I want to be able to take the values from the text inputs and display them in the appropriate table cells on the preview.

The preview is a DHTML table which has visibility set to 'hidden' and is then set 'visible' after the preview button is clicked.

CSS:

Code:
<style>
.panel {
	position: absolute;
	top: 140;
	left: 225;
	width: 355;
	z-index: 1;
	height: 210;
	visibility: hidden;
	overflow: auto;
	border: 1px solid #000000;
	background-color: #FFFFFF;
}
</style>

Javascript:

Code:
function showPreview(previewNum) {
  document.getElementById('preview'+previewNum).style.visibility = 'visible';
  document.getElementById('emplTitle').style.visibility = 'hidden';
}

function hidePreview(previewNum) {
  document.getElementById('preview'+previewNum).style.visibility = 'hidden';
  document.getElementById('emplTitle').style.visibility = 'visible';
}

Preview button:

Code:
<input type="button" value="Preview" onClick="showPreview(1);">

Any ideas of how this can be done? Thanks.

Tony
 
u have to use the ".innerHTML" property of the ocrresponding TD...

e.g:
document.getElementyId(TD'sID).innerHTML="Hello"

Known is handfull, Unknown is worldfull
 
u have to use the ".innerHTML" property of the ocrresponding TD...

e.g:
document.getElementyId(TD'sID).innerHTML="Hello"

Known is handfull, Unknown is worldfull
 
Do I put the .innerHTML in the same function that I use to set the panel to visible like this:

Code:
function showPreview(previewNum) {
  document.getElementById('preview'+previewNum).style.visibility = 'visible';
  document.getElementById('emplTitle').style.visibility = 'hidden';
  
  document.getElementyId('empNameCell').innerHTML="Hello";
}

or does it need to go somewhere else?

I've tried it like this aboce and I get a "Object does not support this property or method error".

Thanks.
 
Oops. No "B" in getElementById. Hello shows up now.

Thanks, Kris. I've got some more work to do so I'll come back and give ya a star :)
 
document.getElementById('preview'+previewNum).innerHTML="ASD"
document.getElementById('preview'+previewNum).style.visibility = 'visible';

'preview'+previewNum is the TD's id right???

Known is handfull, Unknown is worldfull
 
ah, i didnt notice ur second post...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top