Subscribe: RSS
  • Anyone mind sharing his way of making forms with conditional options, for example if user select option A the next input field will be input_a and so on.

    • Man, that would be the holy grail... my experience with this is that these types of forms are always a lot of hard work, with lots of sweaty Javascript...
      • yeah I thought so. I’m trying few things from Dynamic drive but each script has it limitations.
        I was hoping there is a simple way such a mootools/jquery libs that willl make things easier.
        • I’m sure there are libraries that make the journey easier... but of course, you have to sweat through learning the library. More power to the people out there who are good at this stuff, because I know it’s not easy.

          Post back if you find something that helps you.
          • You could use jQuery and Ajax to do this nicely:
              "Things are not what they appear to be; nor are they otherwise." - Buddha

              "Well, gee, Buddha - that wasn't very helpful..." - ZAP

              Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
            • Any ideas on how this could be done with mootools? I am trying to improve the speed of one of my larger sites by reducing external files (css, js, images, etc.). I have been using this: but its very bulky ,but it adds another JS file and loads of additional code to get the forms working correctly.

                Patrick | Co-Founder & Director of Hosting
                SkyToaster | MODX Hosting by MODX Developers
                About Me: Website | TweetsMODX Hosting
              • yeah that’s the latest script I tried to. it’s working but it’s cumbersome. I wonder how phx will handle this smiley
                • I’ve had good success with just a simple onClick javascript event that finds an undisplayed div id and changes the display to block. Here the simple code I use for radio’s. I have the onclick show the div radio displaying the div and the other input hiding it again. I’m sure there’s a way to do this with select inputs too, but I’ve never been able to work it out.

                   <div class="row">
                  			<label for="room_type">Type of Room</label>
                  			<input id="room_type" name="room_type" class="element radio" type="radio" value="indiv" checked="checked" onClick="if(this.checked){document.getElementById('sharing_hide').style.display='none';}" />
                  								<label class="choice">Individual</label>
                  			  <input id="room_type" name="room_type" class="element radio" type="radio" value="dbl" onClick="if(this.checked){document.getElementById('sharing_hide').style.display='block';}else{document.getElementById('sharing_hide').style.display='none';}">
                  			  <label class="choice" >Double</label>
                              <div id="sharing_hide" style="display:none"><div class="row">
                  			<label for="sharing">Sharing Room With:</label>
                  			<input type="text" class="text" name="sharing">

                  Maybe there’s a better way? anyone else use anything else?
                  • What would similar code look like if using a List/Menu instead of Radio Buttons?

                    Selecting a specific selection in the drop down would cause the div to display.

                    Thanks much.
                    • I ended up using this

                      it’s pretty straight forward to config it but seems overload if you can use 4-5 lines of code instead.
                      anyway, it does what I need, like what jmueller0823 talking about.