Results 1 to 6 of 6
  1. #1

    if commands for forms perhaps

    Hi, this is probably a very simple question but i would like to make a quote request form for a website that has a dropdown menu at the top of the page and the rest of the form below that changes depending on which option you select (while remaining on the same page), i assume this can be done with javascript/ css files but i have no idea what such an action would be called, I'm not asking for any actual code, just if anybody knows the correct name for this feature so i can try to find a tutorial. i only want the html form to change appearance in the browser while still being .. um, the same form request in essance, i hope thats clear enough. If anyone can tell me what I'm talking about I'd be very grateful

  2. #2
    Join Date
    Aug 2005
    Location
    UK
    Posts
    654

    Dom

    The "standards compilent" way to do somthing like that is using DOM (Document Object Model). Its a method of accessing page content as a tree of objects.

    Its mainsly used something like this, you fist make the area you want to edit.

    Code:
    <div id="livearea"> </div>
    Then in your JavaScript you find it and edit its contents.

    Code:
    document.getElementById('livearea').innerHTML = 'New html contents'
    You can also use this to add options to select dropdowns and to edit hidden form fields etc..

  3. #3
    ok, thanks for replying, that appears to be what im looking for, im always worried when i hear the phrase "standards compilent" as that usually means "will not work properly in Internet Explorer" but DOM seems perfect for my needs, thanks a lot.

  4. #4
    Join Date
    Aug 2005
    Location
    UK
    Posts
    654
    Lucky, most DOM stuff actually does work in IE

  5. #5
    Quote Originally Posted by Xeentech
    Lucky, most DOM stuff actually does work in IE
    I agree. What he/she said.

  6. #6
    Join Date
    Nov 2003
    Posts
    682
    Make sure your form still works if the user has JavaScript off, usually this means making all the form fields visible to start with then hiding the ones you don't need.

Posting Permissions

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