form input text in table; how to fill table cell space

Discussion in 'HTML' started by sdf, Dec 6, 2007.

  1. sdf

    sdf Guest

    I'm trying to create a table of form input text cells, like this:

    <form>
    <table>
    <thead>
    <tr>
    <th>First Column</th>
    <th>Second Column</th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td><input type="text" name="r1c1" /></td>
    <td><input type="text" name="r1c2" /></td>
    </tr>
    <tr>
    <td><input type="text" name="r2c1" /></td>
    <td><input type="text" name="r2c2" /></td>
    </tr>
    </tbody>
    </table>
    </form>
    </p>

    Is there a way the text input window can be defined to fill the cell
    area no matter
    what size the table is? I could define input's size attribute, I
    tihnk, if the table
    were of a set size, but the table size can vary.

    Thanks.
     
    sdf, Dec 6, 2007
    #1
    1. Advertising

  2. Gazing into my crystal ball I observed sdf <> writing in
    news::

    > I'm trying to create a table of form input text cells, like this:
    >
    ><form>
    ><table>
    ><thead>
    > <tr>
    > <th>First Column</th>
    > <th>Second Column</th>
    > </tr>
    ></thead>
    ><tbody>
    > <tr>
    > <td><input type="text" name="r1c1" /></td>
    > <td><input type="text" name="r1c2" /></td>
    > </tr>
    > <tr>
    > <td><input type="text" name="r2c1" /></td>
    > <td><input type="text" name="r2c2" /></td>
    > </tr>
    ></tbody>
    ></table>
    ></form>
    ></p>
    >
    > Is there a way the text input window can be defined to fill the cell
    > area no matter
    > what size the table is? I could define input's size attribute, I
    > tihnk, if the table
    > were of a set size, but the table size can vary.
    >
    > Thanks.
    >


    Better:
    <form method="post" action="someurl">
    <fieldset><legend>Form or section title</legend>
    <label for="field1">Field1 </label> <input type="text" name="field1"
    id="field1"><br>
    <label for="field2">Field2 </label> <input type="text" name="field2"
    id="field2"><br>
    <p><input type="submit" value="Submit"></p>
    </fieldset>
    </form>

    Replace field with appropriate field names. R1C1 is not really going to
    help you when doing server side form processing - are you going to
    remember what R1C1 is when you are get the information back from the
    client?

    The user also needs some kind of labeling so they know what information
    should be put into the field.

    The elements can be styled with CSS to be whatever width you desire.
    Have a look at http://www.intraproducts.com/usenet/requiredform.asp .
    This form is in ASP but can easily be converted to other languages, and
    the markup, CSS, and server side processing are included.

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, Dec 6, 2007
    #2
    1. Advertising

  3. sdf wrote:
    > I'm trying to create a table of form input text cells, like this:
    >
    > <form>
    > <table>
    > <thead>
    > <tr>
    > <th>First Column</th>
    > <th>Second Column</th>
    > </tr>
    > </thead>
    > <tbody>
    > <tr>
    > <td><input type="text" name="r1c1" /></td>
    > <td><input type="text" name="r1c2" /></td>
    > </tr>
    > <tr>
    > <td><input type="text" name="r2c1" /></td>
    > <td><input type="text" name="r2c2" /></td>
    > </tr>
    > </tbody>
    > </table>
    > </form>
    > </p>
    >
    > Is there a way the text input window can be defined to fill the cell
    > area no matter
    > what size the table is? I could define input's size attribute, I
    > tihnk, if the table
    > were of a set size, but the table size can vary.



    Firstly you know the table will only be as wide as it needs to be for
    the content, so I will set it here for the demonstration

    table { width: 90% }

    Now I can make the inputs 100% but they will overtake any cell padding
    so I will use 99%

    td input { width: 99% }



    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Dec 6, 2007
    #3
  4. sdf

    sdf Guest

    Thanks to both of you, Little and Boswell. - sdf
     
    sdf, Dec 6, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt MC
    Replies:
    2
    Views:
    526
    Thomas 'PointedEars' Lahn
    May 25, 2005
  2. Shuo Xiang

    Stack space, global space, heap space

    Shuo Xiang, Jul 9, 2003, in forum: C Programming
    Replies:
    10
    Views:
    2,939
    Bryan Bullard
    Jul 11, 2003
  3. Christian Seberino
    Replies:
    21
    Views:
    1,723
    Stephen Horne
    Oct 27, 2003
  4. Ian Bicking
    Replies:
    2
    Views:
    1,056
    Steve Lamb
    Oct 23, 2003
  5. Ian Bicking
    Replies:
    2
    Views:
    752
    Michael Hudson
    Oct 24, 2003
Loading...

Share This Page