Jump to content

How do I preview data in accordion page?


sonnieboy

Recommended Posts

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title> Help</title>
 
<script type="text/javascript">
    $(document).ready(function() {
        getBuildings();

        $('#buildingID').change(function() {
            getRevisions( $(this).val() );
        });
    });


    function getBuildings() {
        $.ajax({
            url: 'getBuild.php',
            dataType: 'json'
        })
        .done(function(buildingInfo) {
            $(buildingInfo).each(function(i, building) {
                $('<option>').val(building.BuildingID).text(building.BuildingDisplay).appendTo( $('#buildingID') );
            })
        });
    }


    function getRevisions(buildingID) {
        $.ajax({
            url: 'getRevisions.php',
            dataType: 'json',
            data: { buildingID: buildingID }
        })
        .done(function(floorInfo) {
            $(floorInfo).each(function(i, floor) {
                $('<option>').val(floor.FloorDisplay).text(floor.FloorDisplay).appendTo( $('#floor') );
            })
        });
    }

</script>



</head>
<body>
  <body>

 

<div id="accordion">

  <h3>Builds</h3>

  <div>
    <form name="reqform" method='POST' action='processRequest.php'>
    <p>
       <div class="side-by-side clearfix">
        <div>
          <select name="buildingID" id="buildingID" data-placeholder="Choose a building..." class="chosen-select" style="width:600px;font-size:12pt;">
            <option value="">Choose a building...</option>
              	    <option value="Asp">Asp</option>
		    <option value="BASIC">BASIC</option>
		    <option value="C">C</option>
		    <option value="C++">C++</option>
		    <option value="Clojure">Clojure</option>
		    <option value="COBOL">COBOL</option>
		    <option value="ColdFusion">ColdFusion</option>

          </select>
        </div>
        <br />
        <div>
          <select name="floor" id="floor" data-placeholder="Choose a floor..." class="chosen-select" style="width:600px;font-size:12pt;">
            <option value="">Choose a floor...</option>
              	    <option value="ActionScript">ActionScript</option>
		    <option value="AppleScript">AppleScript</option>
		    <option value="Asp">Asp</option>
		    <option value="BASIC">BASIC</option>
		    <option value="C">C</option>
		    <option value="C++">C++</option>

          </select>
        </div>
        <br />
        <div data-role="content">
          <input type="text" name="room" id="room" value="  Enter a room..." onfocus="clearText(this)" onblur="restoreText(this)" style="width:593px;color:#999;font-size:9pt;height:20px;">
        </div>
      </div>
    </p>
    </form>
  </div>

  <h3>Previews</h3>

  <div>

    <p>

  <form action="process.php">
        <div>
            <p>Building: <span id="bldg_prev"></span>

                <br>Floor: <span id="floor_prev"></span>

                <br>Room: <span id="room_prev"></span>

                <br>
                <br>   <input type="submit" value="Submit"></p>
        </div>

 </form>     
 </p>

  </div>
</div>
 

</body>

</html>

Hello Super Experts,

 

I really need some help.

 

The  pasted code below does two things.

 

getBuildings() grabs data from php file called getBuilds.php and populates a dropdown called buildingID.

 

Then getRevisions() grabs data from a php file called getRevisions.php and populates dropdown called floor based on selected value from buildingID dropdown.

 

These dropdowns and an input textbox are in an accordion page called Buildings.

 

This works very fine.

 

My issue is to modify the js scripts posted below so that user's selections from Buidings accordion page will be previewed on Summary accordion page.

 

I have struggled with this for two days and really stumped.

 

Your assistance is greatly appreciated.

 

 

Link to comment
https://forums.phpfreaks.com/topic/284636-how-do-i-preview-data-in-accordion-page/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.