Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

HTML problem - putting a form in a table

Thread Tools
 
Search this Thread
 
Old 16 July 2002, 04:34 PM
  #1  
DazV
Scooby Regular
Thread Starter
 
DazV's Avatar
 
Join Date: Jun 2000
Posts: 3,783
Likes: 0
Received 0 Likes on 0 Posts
Post

Nothing complex, just trying to workout how to get a textbox and submit button inside a table so they're aligned perfectly in the 'horizontal middle' and 'vertical middle'

In a similar way to the search box on the homepage of www.amazon.co.uk

When I try and do it:


<table border=0 width="100%" align="center" cellspacing="0" cellpadding="0">
<tr>
<td align="center" bgcolor="silver">
<cfform action="home_powders_results.cfm">
Quick Search:
<cfinput type="Text" name="form_quick_search" size=10 required="Yes">
<input type="Submit" size="20" value="GO">
</cfform>
</td>
</tr>
</table>


...the textbox and submit button have an ugly gap beneath them in the row of the table.

Any help would be appreciated. Hope I explained that ok!
Old 16 July 2002, 04:42 PM
  #2  
GaryK
Scooby Regular
 
GaryK's Avatar
 
Join Date: Sep 1999
Location: Bedfordshire
Posts: 4,037
Likes: 0
Received 0 Likes on 0 Posts
Post

Daz,

maybe coldfusion doing something weird, just changed the HTML tags for normal form elements and it looks fine. Havent used CF so cant comment.

Gary
Old 16 July 2002, 04:42 PM
  #3  
legacyPete
Scooby Regular
 
legacyPete's Avatar
 
Join Date: Dec 2001
Posts: 202
Likes: 0
Received 0 Likes on 0 Posts
Post

Put the form outside the table
Old 16 July 2002, 04:45 PM
  #4  
DazV
Scooby Regular
Thread Starter
 
DazV's Avatar
 
Join Date: Jun 2000
Posts: 3,783
Likes: 0
Received 0 Likes on 0 Posts
Post

Gary, I think you're right. Why would it do that though ?

Looks like I'll just have to change it to a standard form item.
Old 16 July 2002, 04:49 PM
  #5  
GaryK
Scooby Regular
 
GaryK's Avatar
 
Join Date: Sep 1999
Location: Bedfordshire
Posts: 4,037
Likes: 0
Received 0 Likes on 0 Posts
Post

Daz,

theres probably some hidden setting in CF that is:

PUT_OBSCURE_AND_UNNECESSARY_SPACE_ROUND_CELLS = 1

or something! Can you use a normal form and set its action to a CF page?

Gary
Old 16 July 2002, 04:53 PM
  #6  
SJ_Skyline
Scooby Senior
 
SJ_Skyline's Avatar
 
Join Date: Apr 2002
Location: Limbo
Posts: 21,922
Likes: 0
Received 1 Like on 1 Post
Exclamation

Daz,

Coldfusion is great at sticking boatloads of "white space" into pages, this can be construed as non-breaking spaces by some browsers.

I believe there is a custom tag somwhere called "stripwhitespace" this will remove the junk spce from your document but you MUST have well formed code or else the page WILL fall over.

As Pete says, stick the form outside the table.

I have found that there is very little difference between <form> and <cfform> apart form cfstudio moaning at you....

As for alignment I would specify these as classes in your style sheet, easier to chop and change that way.

Rich
Old 16 July 2002, 04:55 PM
  #7  
DazV
Scooby Regular
Thread Starter
 
DazV's Avatar
 
Join Date: Jun 2000
Posts: 3,783
Likes: 0
Received 0 Likes on 0 Posts
Post

Seems to do the same when I convert the code to standard HTML...


<table border=1 width="100%" align="center" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle" align="center" bgcolor="silver">
<form action="home_powders_results.cfm" method="get">
<input type="submit" name="submit_searchpowders" value="GO" align="left" style="WIDTH: 50px; HEIGHT: 24px">
</form>
</td>
</tr>
</table>
Old 16 July 2002, 04:57 PM
  #8  
DazV
Scooby Regular
Thread Starter
 
DazV's Avatar
 
Join Date: Jun 2000
Posts: 3,783
Likes: 0
Received 0 Likes on 0 Posts
Post

As soon as the <form> </form> tags are added it adds the ugly space - wonder why ?
Old 16 July 2002, 04:59 PM
  #9  
SJ_Skyline
Scooby Senior
 
SJ_Skyline's Avatar
 
Join Date: Apr 2002
Location: Limbo
Posts: 21,922
Likes: 0
Received 1 Like on 1 Post
Post

Try this:




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<body>
<table border=1 width="100%" align="center" cellspacing="0" cellpadding="0">
<form action="home_powders_results.cfm" method="get">
<tr>
<td valign="middle" align="center" bgcolor="silver">

<input type="submit" name="submit_searchpowders" value="GO" align="left" style="WIDTH: 50px; HEIGHT: 24px">

</td>
</tr>
</form>
</table>


</body>
</html>
Old 16 July 2002, 05:00 PM
  #10  
DazV
Scooby Regular
Thread Starter
 
DazV's Avatar
 
Join Date: Jun 2000
Posts: 3,783
Likes: 0
Received 0 Likes on 0 Posts
Post

SJ, cheers for that.

I DO need it in a table though as that row has a different background color to emphasize it. I'm sure I've done this before with normal HTML, but I can't get it to work with either method at the moment!

Old 16 July 2002, 05:03 PM
  #11  
DazV
Scooby Regular
Thread Starter
 
DazV's Avatar
 
Join Date: Jun 2000
Posts: 3,783
Likes: 0
Received 0 Likes on 0 Posts
Post

SJ, your code works perfectly CHEERS!!
I tried it with cfform and it woks too.
Old 16 July 2002, 05:04 PM
  #12  
SJ_Skyline
Scooby Senior
 
SJ_Skyline's Avatar
 
Join Date: Apr 2002
Location: Limbo
Posts: 21,922
Likes: 0
Received 1 Like on 1 Post
Post

2 years in hell writing CF
Old 16 July 2002, 05:41 PM
  #13  
DazV
Scooby Regular
Thread Starter
 
DazV's Avatar
 
Join Date: Jun 2000
Posts: 3,783
Likes: 0
Received 0 Likes on 0 Posts
Post

Think yourself lucky - I spent a couple of years in hell writing ASP

Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
ATWRX
Full Cars Breaking For Spares
88
01 February 2016 07:28 PM
Justme103
Member's Gallery
16
13 December 2015 09:34 PM
MH-Racing
Subaru Parts
3
10 November 2015 11:36 AM
Decayes
ScoobyNet General
24
15 October 2015 08:58 PM
ossett2k2
Engine Management and ECU Remapping
15
23 September 2015 09:11 AM



Quick Reply: HTML problem - putting a form in a table



All times are GMT +1. The time now is 04:46 AM.