Expandable Contact Form

Discussion in 'Programming' started by Drew007, Jul 31, 2007.

  1. #1
    Hello. I am wondering how to make some options in my contact form expadable. For example, If they check the box, it expands to show the additional options.

    Is there a script out there that will do this?

    Thanks in advance,

    Drew
     
    Drew007, Jul 31, 2007 IP
  2. pruad

    pruad Peon

    Messages:
    71
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It seems you need to apply javascript here. I think there is no ready script. even through there is that you need to tune it anyway.
     
    pruad, Jul 31, 2007 IP
  3. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Javascript will do what you want but if you have a multi-page form then it wont "remember" the status between round trips.

    Using .Net or PHP or such (in conjunction with Ajax is best) will allow the cross post memory.

    If you are validating the inputs on the hidden/ shown fields (eg required or correct format etc) then you almost certainly will need to use serverside as it would be very messy javascript to enable/ disable validation as well as show/ hide nested divs
     
    AstarothSolutions, Aug 1, 2007 IP
  4. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #4
    <script type="text/javascript">
    function byId(id) {
      return document.getElementById ? document.getElementById(id) : document.all[id];
    }
    </script>
    
    <p><a href="nojs.html" onclick="byId('contact_form').style.display=''; return false;">Expand contact form</a></p>
    
    <div id="contact_form" style="display: none;">
    <form>
    ...
    </form>
    </div>
    Code (markup):
     
    krt, Aug 1, 2007 IP
    Drew007 likes this.
  5. Drew007

    Drew007 Peon

    Messages:
    310
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Krt,

    Thanks. Exactly what I needed. Rep added.

    -Drew
     
    Drew007, Aug 2, 2007 IP