SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Addict
    Join Date
    Mar 2006
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form's Without Action Attribute -- Is it a good practise???

    Hi,
    I have a page which has a form which on submission calls itself by action attribute and then after its called it does some display by running queries. I have 3 forms with 3 tables to display these 3 queries data in them. The 3 forms dont have action attribute bcause i dont want processing of the form, and only reason i used form here was because I wanted to use fieldset & legend so it kind of looks neat. Is it a good practise to have a form without action attribute??? I am I missing something important???

    Thanks in advance.

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    That's a terrible reason to use a form. You can just style other elements with CSS you know:
    Code:
    #frame { border: 1px solid #000; }
    #frame-headline { margin-top: -.5em; width: 300px; margin-left: 10px; }
    HTML Code:
    <div id="frame">
    <h2 id="frame-headline">heading</h2>
    </div>

  3. #3
    SitePoint Addict
    Join Date
    Mar 2006
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I dont want to use frames?? I thought ppl avoid frames..

    Is using frames a good idea... I heard ppl usually avoid it... any other options or suggestions...

    by the way, i have attached the snapshot of my page, so u can see what exactly I have done and if theres another better way of doing it. I thought by using forms I would save time and effort since it was very fast and easy to come up with that...

    Thanks,
    Attached Images Attached Images

  4. #4
    Brevity is greatly overrated brandaggio's Avatar
    Join Date
    Dec 2005
    Posts
    1,424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If someone is submitting input then a form is called for.

    If the page just displays results in should not be in a form and thus would not call for a fieldset or legend.

    Based upon your screenshot, I would suggest a clean, hand coded table(s) with table headers and whatnot to replace your legends.

    Display of tabular data calls for tables - it is exactly the place to use them.

  5. #5
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The action attribute is required for the <form> tag, so omitting it is not a good idea. Also, as has been mentioned, using a form to display information is unsemantic. Forms are for user input.

    For outputting tabular data, the semantic choice will be a TABLE.
    Birnam wood is come to Dunsinane

  6. #6
    SitePoint Addict
    Join Date
    Mar 2006
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree with all what everyone has said... but my point is I am doing something bad resources wise or is it a big cardinal sin??

    What if it works fine and doesnt seem to create problems...why not use it features in some other way rather than the orthodox way of passing values....

    I just wanted to be innovative... anyone else wanna point out technicalities rather than the MAIN PURPOSE of FORMS....

  7. #7
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't need the <form> at all. <fieldset><legend> "works" outside forms aswell, but they should only be used to group related form controls, they should not be used because it they have fancy borders. That's not what HTML is about. As Vinnie pointed out, you can replicate fancy borders with CSS using correct HTML. (And no, his proposal has nothing to do with <frame>s.)
    Simon Pieters

  8. #8
    Brevity is greatly overrated brandaggio's Avatar
    Join Date
    Dec 2005
    Posts
    1,424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ajashadi
    I agree with all what everyone has said... but my point is I am doing something bad resources wise or is it a big cardinal sin??

    What if it works fine and doesnt seem to create problems...why not use it features in some other way rather than the orthodox way of passing values....

    I just wanted to be innovative... anyone else wanna point out technicalities rather than the MAIN PURPOSE of FORMS....
    It is is kinda cool what you did. It is kinda logical, but there are better suited tags.

    Personally, I just get a little weirded out when people try to use CSS so much they forget when a table is called for - just wanted to be sure that was not what you were doing.

    Being creative is what it is all about in the end - coming up with elegant solutions to organizing content is not easy and I applaud you for considering new ways to do it.

    Nonetheless, a table is called for in this particular situation.
    Last edited by brandaggio; Jul 8, 2006 at 21:06. Reason: spelling error

  9. #9
    SitePoint Addict
    Join Date
    Mar 2006
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wozbk
    It is is kinda cool what you did. It is kinda logical, but there are better suited tags.
    Being creative is what it is all about in the end - coming up with elegant solutions to organizing content is not easy and I applaud you for considering new ways to do it.
    Nonetheless, a table is called for in this particular situation.
    Hi Wozbk, I know table are used in this situation and I have used the tables to display data.Its just that I wanted to keep them organised in forms. 3 tables in 3 forms with their own legend and diff color to distinguish resultset. Looked clean to me...

    Does anyone know which html tag will help me get the legend functionality?? I tried thead but thats for table head and not for whole table... I want a nice title displayed just like what I am doing with legend tag here.....

    Thanks all,

  10. #10
    doing my best to help c2uk's Avatar
    Join Date
    May 2005
    Location
    Cardiff
    Posts
    1,832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Doesn't render like the fieldset legend but is the semantically correct way to do it for a table:

    <caption> - more info: http://www.w3schools.com/tags/tag_caption.asp
    Dan G
    Marketing Strategist & Consultant

  11. #11
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It seems to me like your markup should look something like this (alter the rank of the headings accordingly):
    HTML Code:
    <div>
     <h2>"legend"</h2>
     <p>Paragraph.</p>
     <table>
      <thead>
       <tr>
        <th>...</th>
        ...
       </tr>
      </thead>
      <tbody>
       <tr>
        <td>...</td>
        ...
       </tr>
       ...
      </tbody>
     </table>
    </div>
    ...
    Code:
    div { background-color:lightblue; color:black; border:solid blue; padding-bottom:2em; }
    h2 { background-color:inherit; float:left; margin:-.5em 0 0 .5em; padding:0 .5em; font-size:inherit; }
    p { font-weight:bold; clear:left; }
    table { border-collapse:collapse; }
    th { text-align:left; border:thin solid; }
    td { border:thin solid; }
    Simon Pieters

  12. #12
    Brevity is greatly overrated brandaggio's Avatar
    Join Date
    Dec 2005
    Posts
    1,424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ajashadi
    Hi Wozbk, I know table are used in this situation and I have used the tables to display data.Its just that I wanted to keep them organised in forms. 3 tables in 3 forms with their own legend and diff color to distinguish resultset. Looked clean to me...

    Does anyone know which html tag will help me get the legend functionality?? I tried thead but thats for table head and not for whole table... I want a nice title displayed just like what I am doing with legend tag here.....

    Thanks all,
    This article explains how to best use tables for data display and when certain tags are called for (and not). It brought some issues to my attention that I had not previously considered, especially in regards to JAWS.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •