HTML Table adding space at the bottom of a row. - html

I have been using this table for a while now and all of a sudden its broken now. I have CSS in my files for it but for whatever reason its now adding a blank line to the bottom of the table row after the form image is posted. It does this even with this same table with no CSS. I have tried table height, spacing, the works. I cannot figure out why there is a blank line here. I apologize if it turns out to be a stupid fix I have searched and tried many fixes.
HERE IS AN EXAMPLE
<table border="1">
<tr>
<td></td>
<td>
<form action="" method="post">
<div>
<input type="hidden" name="id" value="" />
<input type="hidden" name="d" value="1" />
<input type="image" src="../resources/img/direction/up_arrow.png" alt="Up" width="62" height="62" />
</div>
</form>
</td>
<td></td>
</tr>
<tr>
<td>
<form action="" method="post">
<div>
<input type="hidden" name="id" value="" />
<input type="hidden" name="d" value="2" />
<input type="image" src="../resources/img/direction/left_arrow.png" alt="Left" width="62" height="62" />
</div>
</form>
</td>
<td>
<form action="" method="post">
<div>
<input type="hidden" name="id" value="" />
<input type="hidden" name="r" value="1" />
<input type="image" src="../resources/img/direction/rest_button.png" alt="Rest" width="62" height="62" />
</div>
</form>
</td>
<td>
<form action="" method="post">
<div>
<input type="hidden" name="id" value="" />
<input type="hidden" name="d" value="3" />
<input type="image" src="../resources/img/direction/right_arrow.png" alt="Right" width="62" height="62" />
</div>
</form>
</td>
</tr>
<tr>
<td></td>
<td>
<form action="" method="post">
<div>
<input type="hidden" name="id" value="" />
<input type="hidden" name="d" value="4" />
<input type="image" src="../resources/img/direction/down_arrow.png" alt="Down" width="62" height="62" />
</div>
</form>
</td>
<td></td>
</tr>
</table>

The forms of the tds have a margin. Add following css:
form {
margin: 0;
}
To prevent more of this behaviours you should include e.g. a normalize.css instead.

This css is what will solve your problem:
form {margin:0;padding:0}
The extra space was basically coming from your form. You probably removed some old code from css and that's why it suddenly broke.

Related

HTML CSS Centering paypal button in a td in a hidden form

I'm writing a payment page to make a payment from Paypal using Instant Payment Notification. This process is kicked off by POSTing to Paypal using a submit button and a bunch of hidden form fields. As per layout, I have a table and in one of the tds is the form. The HTML looks like this:
<table>
...
<tr id="paymentRow"> <!-- shows the paypal payment information -->
<td valign="top">
<div style="min-height:50px;">
<br/>
<descriptive> Payment</descriptive>
</div>
</td>
<td style="vertical-align:middle; text-align:center;" >
<form style="width:0" action="https://ipnpb.sandbox.paypal.com/cgi-bin/webscr" onsubmit="return validate_payment_form(this)" method="post" />
<input type="image" src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png" title="Check out with PayPal" alt="Submit" name="Submit" id="Submit"/>
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="bob#bob.com" />
<input type="hidden" name="item_name" value="Test purchase item|CustomerID|1" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="return" value="https://mywebsite/paymentReceived.php" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="amount" id="amount" value="1.00" />
<input type="hidden" name="logged_in" value="" />
<input type="hidden" name="<custom>" value="15" />
<input type="hidden" name="notify_url" value="https://mywebsite/paypalNotification.php" /><br />
</form>
</td>
</tr>
...
</table>
There is nothing in my CSS file that sets the alignment for td without the use of a class.
The problem I have is that the paypal button is in the top-left of the td, and I'd like it aligned in the centre/middle. My guess is that this is because it is just one input item in a form. How do I achieve this?
The reason is because you set the form style: width:0 so the td width is also 0; therefore, the image is overflowing and aligned at the left (default alignment for ltr layouts). I'm not sure why you set the form width to 0 but if you remove it, your image will be center-aligned.

How to send the values of a table to an email?

I want to send the total value of this table to an email. I wrapped the mailto around the table but there was no success is doing that. Am I missing something here? I would like to embed this on a wix website.
<form action="mailto:someone#gmail.com" method="post" enctype="text/plain"> <tr>
<td>Patio Set/Workshop Table/Gun Cabinet</td>
<td>
<input type="text" value="" name="7QTY5" id="7QTY5" onKeyUp="multiply()" />
</td>
<td style=display:none;>
<input type="text" name="7PRICE5" id="7PRICE5" value="25" readonly/>
</td>
<td style=display:none;>
<input type="text" name="7TOTAL5" id="7TOTAL5" />
</td> <input type="button" name="Submit1" value="Calculate" onclick="javascript:add()"/><br> Total:
<input type="text" name="9TOTAL" id="9TOTAL" readonly/> <br>
<input type="button" name="Submit2" value="Calculate" onclick="javascript:calculate()"/><br>
<input id= "result" type= "text" value="0"/> Final Result<br/>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>

If XHTML does not allow nested forms, then how/why does this validate? Is this code ok to use?

I'm working on a webpage that lists several rental reservations from a database. I think I may have built myself into a corner. I originally had each row end with 3 cells, each one containing a tiny form made of 2 or 3 hidden fields and a button to "edit", "return", or "cancel" the reservation.
Those worked fine, and were all valid because each entire form was within a single cell.
Now I need to add functionality to allow selecting multiple rows, and passing them to another page. So without thinking, I added a <form> that wrapped around the whole table, added a checkbox to each row, and a submit button at the bottom of the table.
After some research, I'm pretty sure nested forms are not allowed in XHTML. But the document still somehow validates with the W3C validator. I'm using XHTML 1.0 Transitional. Maybe because its not a <form> directly within another <form>, its a <form> within a <table> within a <form>? Is that allowed?
The form works as it is (it submits a few extra fields from the top row, but I can just ignore those if I have to).
I'm just afraid to implement this because I feel like there's no way this is correct. If anyone could clarify whether or not this is valid I would really appreciate it. And if it's not, do you have any suggestions to fix it?
Thanks in advance!
<form id="form2" name="form2" method="post" action="pickup.php">
<table width="1200" border="1" align="center" cellpadding="5" cellspacing="0" style="border-collapse:collapse; border-color:#CCC;">
<tr>
<td colspan="10" bgcolor="#CCCCCC"><h2>Equipment Being Picked Up Today</h2></td>
</tr>
<tr class="highlight">
<td><input type="checkbox" name="res1" id="res1" value="2278" /></td>
<td>George Washington</td>
<td>555-333-4444</td>
<td>Lghting kit 6209</td>
<td>2/12/15</td>
<td>2/13/15</td>
<td></td>
<td align="center">
<form name="editForm" method="post" action="edit.php">
<input name="editFrom" type="hidden" value="today2.php" />
<input name="theDate" type="hidden" value="2015-02-12" />
<input name="reservationID" type="hidden" value="2278" />
<input type="submit" name="edit" value="edit" />
</form>
</td>
<td align="center">
<form name="returnForm" method="post" action="today2.php">
<input name="reservationID" type="hidden" value="2278" />
<input name="return" type="hidden" value="yes" />
<input name="theDate" type="hidden" value="2015-02-12" />
<input type="submit" value="return" />
</form>
</td>
<td align="center">
<form name="cancelForm" method="post" action="cancel.php">
<input name="editFrom" type="hidden" value="today2.php" />
<input name="theDate" type="hidden" value="2015-02-12" />
<input name="reservationID" type="hidden" value="2278" />
<input type="submit" name="cancel" value="cancel" />
</form>
</td>
</tr>
<tr class="highlight">
<td><input type="checkbox" name="res2" id="res2" value="2279" /></td>
<td>Sam Adams</td>
<td>333-222-7777</td>
<td>camera kit 3456</td>
<td>2/12/15</td>
<td>2/13/15</td>
<td></td>
<td align="center">
<form name="editForm" method="post" action="edit.php">
<input name="editFrom" type="hidden" value="today2.php" />
<input name="theDate" type="hidden" value="2015-02-12" />
<input name="reservationID" type="hidden" value="2279" />
<input type="submit" name="edit" value="edit" />
</form>
</td>
<td align="center">
<form name="returnForm" method="post" action="today2.php">
<input name="reservationID" type="hidden" value="2279" />
<input name="return" type="hidden" value="yes" />
<input name="theDate" type="hidden" value="2015-02-12" />
<input type="submit" value="return" />
</form>
</td>
<td align="center">
<form name="cancelForm" method="post" action="cancel.php">
<input name="editFrom" type="hidden" value="today2.php" />
<input name="theDate" type="hidden" value="2015-02-12" />
<input name="reservationID" type="hidden" value="2279" />
<input type="submit" name="cancel" value="cancel" />
</form>
</td>
</tr>
<tr class="highlight">
<td><input type="checkbox" name="res3" id="res3" value="2280" /></td>
<td>Bob Dole</td>
<td>111-222-4444</td>
<td>Other item 6789</td>
<td>2/12/15</td>
<td>2/13/15</td>
<td></td>
<td align="center">
<form name="editForm" method="post" action="edit.php">
<input name="editFrom" type="hidden" value="today2.php" />
<input name="theDate" type="hidden" value="2015-02-12" />
<input name="reservationID" type="hidden" value="2280" />
<input type="submit" name="edit" value="edit" />
</form>
</td>
<td align="center">
<form name="returnForm" method="post" action="today2.php">
<input name="reservationID" type="hidden" value="2280" />
<input name="return" type="hidden" value="yes" />
<input name="theDate" type="hidden" value="2015-02-12" />
<input type="submit" value="return" />
</form>
</td>
<td align="center">
<form name="cancelForm" method="post" action="cancel.php">
<input name="editFrom" type="hidden" value="today2.php" />
<input name="theDate" type="hidden" value="2015-02-12" />
<input name="reservationID" type="hidden" value="2280" />
<input type="submit" name="cancel" value="cancel" />
</form>
</td>
</tr>
<tr>
<td colspan="10">
<input type="submit" name="submit" id="submit" value="Pickup Selected Equipment" />
</td>
</tr>
</table>
</form>
It validates because the formal validation of XHTML 1.0 is based on XML rules, and XML is a strongly simplified modification of SGML, which is what HTML 4.01 is nominally based on. Consequently, some features, such as nested forms, which are prohibited in all versions of HTML are not forbidden by the formal syntax of XHTML 1.0 described in a DTD based on XML. The specification says this as follows:
SGML gives the writer of a DTD the ability to exclude specific
elements from being contained within an element. Such prohibitions
(called "exclusions") are not possible in XML.
For example, the HTML 4 Strict DTD forbids the nesting of an 'a'
element within another 'a' element to any descendant depth. It is not
possible to spell out such prohibitions in XML. Even though these
prohibitions cannot be defined in the DTD, certain elements should not
be nested. A summary of such elements and the elements that should not
be nested in them is found in the normative Element Prohibitions.
And the Element Prohibitions says that a form element must not contain another form element.
It is not safe to nest forms. There is no specification of what should happen if you do that. For example, it is not specified whether the fields on an inner form should be included when an outer form is submitted.
Thus, you should consider restructuring the page so that form nesting is avoided. If you need help with this, consider posting a new question that specifies the desired functionality and shows your best attempt at restructuring.

HTML max-width does't work on cell

I am about to create a simple HTML table. I'd like some of the cells to dont change their width, not even if the available space for the table increases (eg: higher resolution).
I have created a JSF with my code. My problem is that if I move the vertical separator all the way to the left the column with the delete button starts to get wider instead of keeping its size.
Please help me out how can I do it.
Thanks!
<!DOCTYPE HTML>
<html lang="en-US">
<title>User Management</title>
<body>
<table cellspacing="0" border="1" style="width:80%;">
<tr>
<td>
<form action="/link1" method="post">
<div style="max-width:60px;display:block;">
<input type="hidden" name="id" value="1" />
<input type="button" name="Confirm" value="Delete" onclick="UserConfirm(this)" />
</div>
</form>
</td>
<form action="/link2/" method="post">
<td style="margin:10px;max-width:60px;">
<input type="text" name="id" value="1" style="display:none" />1</td>
<td style="margin:10px;">
<input type="text" name="username" value="1" style="display:none" />johnd</td>
<td style="margin:10px;">
<input type="text" name="firstname" value="John" style="width: 80px;" maxlength="10" required />
</td>
</form>
</tr>
</table>
</body>
</html>
Just assign some small width for the TD of your button like below.
<td width="10">
<form action="/link1" method="post">
<div style="max-width:60px;display:block;">
<input type="hidden" name="id" value="1" />
<input type="button" name="Confirm" value="Delete" onclick="UserConfirm(this)" />
</div>
</form>
</td>
Fiddle Demo

How to control auto form fill

my question is how to control fill entries in textfield.
http://support.mozilla.org/en-US/kb/control-firefox-automatically-fills-in-forms
In my app I have page with login form which have username textField. Then I have registration page with email textField. Now I have problem that firefox rember entries which I enter to username textField also in email textField. But when I enter value to email textField firefox does rember it. Same with chrome browser
form1
<form wicket:id="signInForm">
<table>
<tr>
<td align="right"><wicket:message key="username">
Username
</wicket:message></td>
<td><input wicket:id="username" type="text" /></td>
</tr>
<tr>
<td align="right"><wicket:message key="password">
Password
</wicket:message></td>
<td><input wicket:id="password" type="password" /></td>
</tr>
<tr wicket:id="rememberMeRow">
<td></td>
<td><input wicket:id="rememberMe" type="checkbox" /> Remember
Me</td>
</tr>
<tr>
<td></td>
<td><input class="tournamentButton" type="submit"
wicket:id="signIn" value="Sign In" /> <input class="tournamentButton"
type="reset" value="Reset" /> <input class="tournamentButton"
type="submit" wicket:id="register" value="Register" /></td>
</tr>
</table>
</form>
form2
<form class="userform" wicket:id="userEditForm">
<fieldset>
<legend>
<wicket:message key="user">
User
</wicket:message>
</legend>
<div>
<label wicket:for="name"><wicket:message key="name">
Name:
</wicket:message></label><input type="text" wicket:id="name" />
</div>
<div>
<label wicket:for="surname"><wicket:message key="surname">
Surname:
</wicket:message></label><input type="text" wicket:id="surname" />
</div>
<div>
<label wicket:id="userNameLabel" /> <input type="text"
wicket:id="userName" />
</div>
<div>
<label wicket:for="email"><wicket:message key="email">
Email:
</wicket:message></label><input type="email" wicket:id="email" />
</div>
<div>
<label wicket:for="password"><wicket:message key="password">
Password:
</wicket:message></label><input type="password" wicket:id="password" />
</div>
<div>
<label wicket:for="confirmPassword"><wicket:message
key="confirmPassword">
Confirm Password:
</wicket:message></label><input type="password" wicket:id="confirmPassword" />
</div>
<div>
<label wicket:id="platnostLabel" /> <input type="text"
wicket:id="platnost" />
</div>
<div>
<label wicket:id="roleLabel" /><input type="text" wicket:id="role" />
</div>
</fieldset>
<div>
<input class="tournamentButton" type="submit" wicket:id="submit"
value="Save" /> <input class="tournamentButton" type="submit"
wicket:id="back" title="back" value="Back" />
</div>
</form>
In your HTML add the attribute autocomplete="off" to input fields where you dont want browsers to remember that information. For example:
<input type="text" autocomplete="off" wicket:id="userName" />
EDIT: 02.2018:
Browser behavior changed over time and now for login and password fields autocomplete off is not supported in modern browsers:
https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#The_autocomplete_attribute_and_login_fields