Hey guys, another part of program I am stuck at is to create an email storage / reference system. I need the first line to hold the basic info, from to address etc and then a second row to store the message and any comments in a text box. The problem I am having is that I put the two into different tables so when a new line is added it adds to both them. Is it possible to do this e.g to have on the second add to append it to the bottom table?
I To | | From | | Date | | Subject |
| Message | | onClick() |
Which would go to
I To | | From | | Date | | Subject |
| Message |
I To | | From | | Date | | Subject |
| Message | | onClick() |
And so on. Here is the code i have so far ....
[HTML]<html>
<head>
<script type="text/javascript">
function removeRowFromTa ble()
{
var tbl = document.getEle mentById('myTab le');
var lastRow = tbl.rows.length ;
if (lastRow > 2) tbl.deleteRow(l astRow - 1);
var tbl1 = document.getEle mentById('myTab le1');
var lastRow1 = tbl1.rows.lengt h;
if (lastRow1 > 2) tbl1.deleteRow( lastRow1 - 1);
}
</script>
<script type="text/javascript">
function doThis()
{
var myTab = document.getEle mentById('myTab le');
var row=myTab.rows. length;
var y=myTab.insertR ow(row);
var a=y.insertCell( 0);
var xx= document.create Element('input' );
xx.type="text";
xx.name="EmailF rom[]";
a.appendChild(x x);
var b=y.insertCell( 1);
var xx= document.create Element('input' );
xx.type="text";
xx.name="EmailT o[]";
b.appendChild(x x);
var c=y.insertCell( 2);
var xx= document.create Element('input' );
xx.type="text";
xx.name="EmailD ate[]";
c.appendChild(x x);
var d=y.insertCell( 3);
var xx= document.create Element('input' );
xx.type="text";
xx.name="EmailS ubject[]";
d.appendChild(x x);
var myTab1 = document.getEle mentById('myTab le1');
var row1=myTab1.row s.length;
var z=myTab1.insert Row(row1);
var e=z.insertCell( 0);
var xx= document.create Element('textar ea');
xx.col="200"
xx.rows="5"
xx.name="Messag e[]";
e.appendChild(x x);
}
</script>
</head>
<body>
<br/>
<input type="button" value="Add" onclick="doThis ()">
<input type="button" value="Remove" onClick="remove RowFromTable()" >
<br/>
<table id="myTable" border="1" cellspacing="5" cellpadding="5" >
<tr>
<th>From</th>
<th>To</th>
<th>Date</th>
<th>Subject</th>
</tr>
<table id="myTable1" border="1" cellspacing="5" cellpadding="5" >
<tr>
<th>Message</th>
</tr>
</table>
</table>
</body>
</html>[/HTML]
Any help much appreciated
12 1768 acoder 16,027
Recognized Expert Moderator MVP
The second table has been (incorrectly) nested in the first.
Please use code tags when posting code. See How to ask a question.
my apologies im fairly new to this forum but in future i will post with regards to the "how to..."
In relation to what you said do you mean that you cannot nest tables like this or that I have nested it wrongly but it can work.
what are your thoughts on this?
acoder 16,027
Recognized Expert Moderator MVP
I haven't tested your code, but I noticed that myTable1 is nested inside myTable after a row, but not inside a table cell. Did you mean to nest tables like that or was it supposed to be outside the main table?
No it is meant to be inside the table but im not 100% sure if it is the way to go... the real question im asking is can i have one table that will have two different rows of headers. e.g. can a table be
| 1 | | 2 | | 3 |
|input 1| | input2| |input3|
| 4 |
| input 4 |
then onclick will add another full two rows for input.
the reason y im looking this is ive been asked to store emails so correspondence can be viewed (along with alot of other info) with in the one system. The from, to and subject are all low character fields whereas the email can be quite large and so doing it
| 1 | | 2 | |3 | |4 | will not look good as input 4 is a text area around 60 by 5.
hope i have been able to clarify the problem a bit more :)
acoder 16,027
Recognized Expert Moderator MVP
How would you match up the rows? Say you have 3 rows. If the first three columns are separated from the message column, how will the users know which refers to which?
PS. to answer your question on whether it's possible, it is.
that was the problem... from the way the code works now it isnt the prettiest to look at... as a first step i have just attached it to another column at the end of the first three inputs but again it doesnt really look right. the only other way i can think of doing it is that on the first pass it will do as normal but then passes after this will add to the second table although headings will not be there. Have you any ideas on a better solution cus i am more r less a noob with html.
acoder 16,027
Recognized Expert Moderator MVP
One way it could work is that you display the message textarea without a header underneath the other three columns on its own.
That would still leave the problem that each new record would be stored under the headings and the message field would store underneath it...
| 1 | | 2 | 3 |
inputs
| ::::::::::::::: ::::::::::::::|
2nd pass
| 1 | | 2 | | 3 |
inputs
inputs
|:::::::::::::: ::::::::::::::: :|
|:::::::::::::: ::::::::::::::: :|
As I am appending to the table, is this was you mean?
acoder 16,027
Recognized Expert Moderator MVP
No, I meant something like this: - | 1 | | 2 | 3 |
-
inputs
-
| :::::::::::::::::::::::::::::|
-
2nd pass - | 1 | | 2 | | 3 |
-
inputs
-
|::::::::::::::::::::::::::::::|
-
inputs
-
|::::::::::::::::::::::::::::::|
-
Is that OK?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: ojvm |
last post by:
ok. thanks again for the time spend reading this.
this code adds 2 controls in html form but it places in top of the
form.
i want this
control1 control2
control1 control2
control1 control2
|
by: Philippe C. Martin |
last post by:
Hi,
I am trying to change the data in a form field from python. The following
code does not crash but has no effect as if "form" is just a copy of the
original html form.
Must I recreate the form order to do that ?
My point is for the client to be able to re-read the modified data.
|
by: patricksabourin |
last post by:
On my site,
I have 2 methods of displaying my data:
1) HTML form with select-option element. (Jump to different page when
clicking "Go" button"
2) HTML table with a hyperlink.
What I would like to do is the following:
If JavaScript is disabled (or non existant on some browsers), to NOT
display the HTML form with select-option element.
|
by: bp_jobemail |
last post by:
I'm trying to use PHP to wrap the output of an HTML form before it goes
into a precompiled C cgi script.
Essentially, the company that I work for uses a purchased precompiled c
program for their shopping cart. This C program stores order
information, and when an order is processed and approved, records the
transaction and sends a template email to the customer with an invoice
describing their purchase. Since we're going to be selling a...
|
by: w33nie |
last post by:
This html form that I'm using works fine, apart from that it never ends up sending any information through to my designated email.
Does anyone see a problem in my code?
<form name="formTeamApplication" action="teams_process.php" method="post">
<input type='hidden' name='esh_formmail_recipient' value="rowan.cavanagh@hotmail.com">
<input type='hidden' name='esh_formmail_subject' value="Team Application">
<table width="100%"...
| |
by: Jibran |
last post by:
I need some help with extra spaces in HTML form. There is a big white space appearing at the center of the HTML form that I am designing even though there is no <br> tags been used:
http://i116.photobucket.com/albums/o9/Jibran82/Pic1.jpg
The html code is below:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta
http-equiv="Content-Type"
|
by: jpenguin |
last post by:
This should be simple, but I'm stuck
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db('joshdye', $con);
|
by: luckysanj |
last post by:
I have problem on creating academic table.
I need to input from html form to different academic table.
But how to create academic table for my requirement.
I have different leve of student.
Like
SLC Borard Pass Year Division Percentage
Intermediate Pass Year Division Percentage
|
by: beary |
last post by:
Hi
Being tested using FF 3 on WAMP server. I have spent a number of hours trying to figure this out myself.
I have a html form using table cells and had a request to enable the arrow keys on a keyboard to move through the cells. I found some code and adapted it, and it works well now. Arrow keys move the cursor exactly to the correct cell. There are two things I can't do which I was hoping you guys would give me some help on. I am a...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |