how to get the values in the textboxes when a radio button is selected?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kiranbabu
    New Member
    • Jun 2009
    • 10

    how to get the values in the textboxes when a radio button is selected?

    [code=php]
    <html>
    <head>
    <h2 align=center>Bl ank Tapes Status Form</h2>

    <br><title>Blan k tapes status</title>
    </head>

    <body>
    <br><br>
    <form name=tapes_stat us method=post>


    <center>
    <fieldset style='width:40 %'><legend>Blan k_Tapes_Status_ Form</legend>
    <table align=center border=1 >
    <tr><td><font face=Verdana size=3><b>Chann el</b></font></td>
    <td><input type=channeltex tbox size=20 id=channels readonly name=channels style="width:10 0px" value="<?php echo $ChannelName?>" ></td>


    <td><font face=Verdana size=3><b>Total Recieved</b></font></td>
    <td><input type=totalrecie vedtextbox size=20 id=totalrecieve d name=totalrecie ved style="width:10 0px" onclick=Total_r ecieved_tapes() ></td> </tr>


    <tr><td><font face=Verdana size=3><b>Forma t</b></font></td>
    <td><select id=format name=format size=1 style="width:15 5px">
    <option>[Select One]</option><?php Format();?>

    </select></td>

    <td><font face=Verdana size=3><b>Total Issued</b></font></td>
    <td><input type=totalissue dtextbox size=20 id=totalissued name=totalissue d style="width:10 0px" onclick=Total_i ssued_tapes()></td></tr>


    <td><input type=radio id=optStatus checked name=optStatus style='width: 40px height: 20px' onclick=fnReloa d("B")>Blank <br></td>
    <td><input type=radio id=optStatus name=optStatus style='width: 40px; height: 20px' onclick=fnReloa d("R")>Re-Use</td>
    <td><font face=Verdana size=3><b>Avail able Tapes</b></font></td>
    <td><input type=textbox size=20 id=availabletap es name=availablet apes style="width:10 0px" onclick=Availab le_tapes()></td>
    </tr>
    </table>
    </center>
    </fieldset>

    <?php ReUse_Details() ; ?>


    <!--</fieldset>-->


    &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; <br><br><br><br ><br>


    <?php
    function Format()

    {
    $dbconnect=pg_c onnect("host=10 .10.1.3 dbname=Tape_Lib rary user=postgres password=post12 3") or
    die("could not connect to the database");
    $query = "select tms003_typecode ,tms003_typenam e from tms_master_tapf ormat";

    $result = pg_query($query ) or die ("Could not Open Records") . pg_last_error() ;

    while($row = pg_fetch_row($r esult))
    {

    echo "<option value='" . $row[0] . "'>";
    echo $row[1];
    echo "</option>";
    }
    pg_free_result( $result);
    }


    function ReUse_Details()
    {

    $dbconnect = pg_connect("hos t=10.10.1.3 dbname=Tape_Lib rary user=postgres password=post12 3") or
    die('Could not Open COnnection...') . pg_last_error() ;
    $query=" select distinct(tms010 _barcode),tms01 0_reassign_coun t,tms021_assign _date from
    tms_trans_tapes assign_details left outer join tms_trans_reass ign_details on
    tms010_barcode= tms021_barcode and tms021_channel_ id=tms010_chann el_id
    where tms010_channel_ id='H0002' and tms010_tapeform at_id= '2'
    and tms010_availabl e_flag='Y' ";

    if ($_GET['status'] == "B") //Blank
    {
    $query = $query . " and tms010_balnk_fl ag='Y'";
    $query = $query . " and tms010_reassign ed_flag='N'";
    }
    else
    if ($_GET['status'] == "R") //Reuse
    {
    $query = $query . " and tms010_reassign ed_flag='Y'";
    }
    $query = $query . " and tms010_content_ flag='N'";
    $query = $query . " and tms010_delete_f lag='OK' ";

    $result = pg_query($query ) or die('Could not Open Recordset...') . pg_last_error() ;

    echo"<br><br><b r><br><br>";

    echo "<table border=1 align=center>";
    echo "<tr><th>SR .NO</th>";
    echo " <th>Tape Number</th>";
    echo " <th>Date</th>";
    echo "</tr>";

    $count = 1;
    while($row = pg_fetch_row($r esult))
    {
    echo "<tr><td>" . $count . "</td>";
    echo "<td>" . $row[0] . "</td>";
    echo "<td>" . $row[1] . "</td>";
    echo "</tr>";
    $count++;

    }

    $query="SELECT * FROM tms_trans_reass ign_details where tms021_channel_ id='H0006' and tms021_channel_ assign_to='H000 5' and tms021_tapeform at_id='2' ";

    echo "</table>";

    pg_free_result( $result);
    pg_close($dbcon nect);

    }


    function Blank()
    {

    $dbconnect = pg_connect("hos t=10.10.1.3 dbname=Tape_Lib rary user=postgres password=post12 3") or
    die('Could not Open COnnection...') . pg_last_error() ;

    $query = "select sum(tms019_no_o f_tapes_issue_r ec) as temp from tms_trans_closi ng_balance where tms019_channel= 'H0006' and tms019_tape_for mat='CD-R' and tms019_status=' ISU' ";

    $result = pg_query($query ) or die('Could not Open Recordset...') . pg_last_error() ;

    echo"<br><br><b r><br><br>";

    echo "<table border=1 align=center>";
    echo "<tr><th>SR .NO</th>";
    echo " <th>Tape Number</th>";
    echo " <th>Date</th>";
    echo "</tr>";

    $count = 1;

    while($row = pg_fetch_row($r esult))
    {

    echo "<tr><td>" . $count . "</td>";
    echo "<td>" . $row[0] . "</td>";
    echo "<td>" . $row[1] . "</td>";
    echo "</tr>";
    $count++;
    }
    echo "</table>";

    pg_free_result( $result);
    pg_close($dbcon nect);


    }

    ?>

    <br><br><br><br >
    <table align=center><t r><td>
    <input type='submit' name='exit' id='exit' value='EXIT' style="width:75 px" onclick='window .close()'><td></tr></table>

    </form>
    <script language=javasc ript>

    var stat = "<?php echo $_GET['status']; ?>";

    if (stat == "B")
    {
    tapes_status.op tStatus[0].checked = true;
    }
    else
    {
    tapes_status.op tStatus[1].checked = true;
    }

    function fnReload(stat)
    {

    var redir = "blank_tapes_st atus.php?status =" + stat;

    alert(redir);

    window.open(red ir, "_top");
    }



    function Total_recieved_ tapes()
    {
    var recieved_tapes = tapes_status.op tStatus.value;
    tapes_status.to talrecieved.val ue = recieved_tapes;

    }

    function Total_issued_ta pes()
    {

    var issued_tapes = tapes_status.op tStatus.value;
    tapes_status.to talissued.value = issued_tapes;

    }
    function Available_tapes ()
    {

    var aval_tapes = tapes_status.op tStatus.value;
    tapes_status.av ailabletapes.va lue = aval_tapes;
    }

    </script>

    </body>
    </html>
    [/CODE]

    Hi,any one help me,when i select a reuse radio button i have to get total recieved tapes,total issued tapes,total available tapes into the textboxes.
    Last edited by Atli; Jun 5 '09, 08:40 AM. Reason: Fixed the [code] tags.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    First of all, your markup is a mess. (No offense)
    You should really use the W3C validation page to clean it up a bit.

    You may also want to read up on CSS to get rid of those ancient <font> tags, and to further clean up the markup.

    As to the question...

    Could you please explain this a little better, and perhaps show us exactly where in all that code your problem is occurring. (It's a lot of code)

    Comment

    • kiranbabu
      New Member
      • Jun 2009
      • 10

      #3
      radio button

      Code:
      <html>
      <body>
      <td><font face=Verdana size=3><b>Total Recieved</b></font></td> 
        <td><input type=totalrecievedtextbox size=20 id=totalrecieved>
      
      td><font face=Verdana size=3><b>Total Recieved</b></font></td> 
        <td><input type=totalrecievedtextbox size=20 id=totalrissuedd >
      
      td><font face=Verdana size=3><b>Total Recieved</b></font></td> 
        <td><input type=totalrecievedtextbox size=20 id=total available> 
      
      td><input type=radio id=optStatus checked name=optStatus style='width: 40px height: 20px' onclick=fnReload("B")>Blank <br></td>
      
      <script language=javascript> 
        
      function Total_recieved_tapes() 
              { 
                       var recieved_tapes = tapes_status.optStatus.value; 
                      tapes_status.totalrecieved.value = recieved_tapes; 
        
              } 
        
             function Total_issued_tapes() 
       { 
        
                      var issued_tapes = tapes_status.optStatus.value; 
                      tapes_status.totalissued.value = issued_tapes; 
        
              } 
                function Available_tapes() 
                { 
        
                       var aval_tapes = tapes_status.optStatus.value; 
                      tapes_status.availabletapes.value = aval_tapes; 
                } 
        
      </script> 
        
      </body> 
      </html>

      when i select radio button i have get the total recieved,total issued,total available tapes in their textboxes.i am using postgresql database.how to get the data in the textboxes.
      Last edited by Markus; Jun 6 '09, 10:19 AM. Reason: Added [code] tags,

      Comment

      • code green
        Recognized Expert Top Contributor
        • Mar 2007
        • 1726

        #4
        If you are using Javascript you need something like
        Code:
        document.YourFormName.YourTextBoxName.value = "Write value here";

        Comment

        Working...