SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,266
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)

    textarea question

    This might have a scripting answer, but if so I don't know of it.

    I've been using textareas in forms to show in readonly mode our Conditions, where the user reads them and then checks the "I agree" checkbox. Well, it turns out the whole multipage Conditions document is sent with the rest of the form, which I guess it's supposed to as it's really an input... but, I'd like it NOT to be an input. So I've thought it over and found a few things:

    For some reason, textarea is completely legal outside a form. I'm not sure why, if it's whole existance was meant as a form control. I've tried setting our textarea outside the form but it looks unintuitive at the least. But the submit of the form obviously doesn't submit the textarea, which is what we want (unless it's no big deal, but isn't it extra bloataceous work for the browser that it doesn't need to do?)

    Setting disabled="disabled" prevents the textarea from being submitted. It's still readable at least in FF but as focus is prevented from touching the textarea, the low contrast and the fact that somewhere I know there's a browser who will stop the scrollbar from showing up anyway makes this not an option. However, I wonder if there's a script or setting I can use to set the textarea to "disabled" on Submit? I also read somewheres on teh googlies about disabled not being applicable in XHTML, which is what I'm using.

    Since what I need is not really an input but actually a sort of label (telling info to the user), I've thought of using a <p> with <pre> and overflow: auto. So far this seems to be the better choice but I'd like opinions/facts suggesting otherwise if this is the case.

    Should I keep textarea to show Terms and Conditions before a checkbox "I agree to the above" or should I use something like a <p> to do this job?

    Thx.

  2. #2
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you should keep it as a textarea and just change the way the form is processed (so that the textarea is not processed)

    I don't really see any problem with using overflow:auto on a <p> or <div> but it is probably not semantically correct to do so... I'd imagine that a textarea is better to use for accessibility reasons.

    That said, you have more control over the formatting of the text within a <div>.
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  3. #3
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,266
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    Yeah actually, if I use <p> or <div> I'll have <pre> because I want simple text-editor formatting (preserve the formatting it came with, not using tags for it).

    So, I can script my way out of this? Or make it part of the whole submit process that's going on?

    * on second thought, I'm pretty sure I don't want anything like onsubmit, textarea becomes disabled... so I'm looking for something within the actual form submit process... anyone point me the way? I will continue to search teh googlies.

    *and I've got someone else telling me it's no work for the browser at all and I can just leave the whole thing : )

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should be able to use a textarea inside the form without it being submitted. Just leave out the name attribute. Only form controls with a name attribute are submitted.
    Birnam wood is come to Dunsinane

  5. #5
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,266
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    Sweet Baby Jebus! My colleague is slapping himself. THANK YOU.

    We definitely owe you a beer, Tommy... show up at that Game-software conference they're having in Malmo and my colleague will be there : )

    Sweet Jebus...

  6. #6
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Glad I could help.
    Birnam wood is come to Dunsinane


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
  •