Reference field in mult-record form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rose

    #1

    Reference field in mult-record form

    I want to use the javascript dom to reference the field of a record in a
    multi-record html form when that field has been changed. How do I reference
    the field? I have a JavaScript function coded as:

    var zownerID = document.updOwn ers.ownerID.val ue
    var zownerName = document.updOwn ers.ownerName.v alue
    document.updOwn ers.mysql_updat e.value = zownerID
    document.updOwn ers.newName.val ue = zownerName

    I have tried calling it from onclick for the submit button and onsubmit for
    the form with no success. Very new to javascript and would appreciate any
    help. Thanks


  • RobB

    #2
    Re: Reference field in mult-record form

    Rose wrote:[color=blue]
    > I want to use the javascript dom to reference the field of a record[/color]
    in a[color=blue]
    > multi-record html form when that field has been changed. How do I[/color]
    reference[color=blue]
    > the field? I have a JavaScript function coded as:
    >
    > var zownerID = document.updOwn ers.ownerID.val ue
    > var zownerName = document.updOwn ers.ownerName.v alue
    > document.updOwn ers.mysql_updat e.value = zownerID
    > document.updOwn ers.newName.val ue = zownerName
    >
    > I have tried calling it from onclick for the submit button and[/color]
    onsubmit for[color=blue]
    > the form with no success. Very new to javascript and would appreciate[/color]
    any[color=blue]
    > help. Thanks[/color]

    Hi Rose.

    'javascript dom' is a misnomer: the former is a scripting language, the
    latter a language-independent object model.

    Not entirely clear what you're trying to do. Post your HTML along with
    a description of what you need to happen.

    Comment

    • Lee

      #3
      Re: Reference field in mult-record form

      Rose said:[color=blue]
      >
      >I want to use the javascript dom to reference the field of a record in a
      >multi-record html form when that field has been changed. How do I reference
      >the field? I have a JavaScript function coded as:
      >
      > var zownerID = document.updOwn ers.ownerID.val ue
      > var zownerName = document.updOwn ers.ownerName.v alue
      > document.updOwn ers.mysql_updat e.value = zownerID
      > document.updOwn ers.newName.val ue = zownerName
      >
      >I have tried calling it from onclick for the submit button and onsubmit for
      >the form with no success. Very new to javascript and would appreciate any
      >help. Thanks[/color]

      Don't use the onclick of the submit button. Some browsers don't
      support such a thing, and there are often other ways to submit a
      form than clicking the button.

      <form ... onsubmit="doStu ff(this)">

      function doStuff(formRef ) {
      formRef.mysql_u pdate.value = formRef.ownerID .value;
      formRef.newName .value = formRef.ownerNa me.value;
      }

      Comment

      • Rose

        #4
        Re: Reference field in mult-record form

        I am displaying names selected from a mysql database table. I want to be
        able to change a name and have that change update the mysql database table.
        This is the html, javascript, and php code. Thanks...

        <html>
        <head>
        <link href="../../../../../../styles/canDC.css" rel="stylesheet "
        media="screen">
        <script type="text/javascript" name="fpownerID " language="JScri pt5.0">
        <!--
        function fpownerID()
        {
        var zownerID = document.updOwn ers.ownerID.val ue;
        var zownerName = document.updOwn ers.ownerName.v alue;
        document.updOwn ers.mysql_updat e.value = zownerID;
        document.updOwn ers.newName.val ue = zownerName;
        alert("Function Executed");
        }
        // -->
        </script>
        <csactions>
        <csaction name="1AE4950" class="Call Function" type="onevent"
        val0="fpownerID " val1=""></csaction>
        </csactions>
        <csscriptdict import>
        <script type="text/javascript"
        src="../../../../../../GeneratedItems/CSScriptLib.js" ></script>
        </csscriptdict>
        <csactiondict >
        <script type="text/javascript"><!--
        CSAct[/*CMP*/ '1AE4950'] = new Array(CSCallFun ction,'fpownerI D','');

        // --></script>
        </csactiondict>
        </head>
        <body bgcolor="#fffff f" leftmargin="0" marginheight="0 " marginwidth="0"
        topmargin="0">
        <form action="Process Form.php" method="post" name="updOwners "
        onsubmit="CSAct ion(new Array(/*CMP*/'1AE4950'));" cssubm="1AE4950 ">
        <table height='200px' width='385' border='1px' cellspacing='1p x'
        cellpadding='0' align='center'>
        <tr><td class="can"><di v style='align:ce nter; height:100%; width:100%;
        overflow:auto'>
        <table class="can" height='100%' width='100%' border='1px'
        cellspacing='2p x' cellpadding='0' align='center'>
        <?php
        $zqueryRecords= " SELECT o.ownerID, o.ownerName FROM fp_owners o WHERE
        o.ownerID> 0 ORDER BY o.ownerName";
        $resultRecords= mysql_query($zq ueryRecords);
        echo mysql_error();
        while($zRecords = mysql_fetch_arr ay($resultRecor ds))
        {
        ?>
        <tr align='center'>
        <td class='formFiel d'>
        <input type='hidden' name='ownerID' value='<?php echo
        $zRecords[ownerID];?>'>
        <input class="left" type='text' name='ownerName ' size='40' maxlength='50'
        value='<?php echo $zRecords[ownerName];?>'>
        <input class="button" type="submit" name="updButton "
        value="Update"> </td></tr>
        <?php }?>
        </table>
        </div>
        </td>
        </tr>
        </table>
        <div align="center">
        <input type="hidden" name="newName" value="">
        <input type="hidden" name="required" value="mysql_up date_value, newName">
        <input type="hidden" name="redirect" value="brmv_own ers.php">
        <input type="hidden" name="redirect_ type" value="include" >
        <input type="hidden" name="mysql_tab le" value="fp_owner s">
        <input type="hidden" name="write_to_ mysql" value="newName > ownerName">
        <input type="hidden" name="mysql_upd ate_field" value="ownerID" >
        <input type="hidden" name="mysql_upd ate_value" value=""></div>
        </form>
        </body>
        </html>


        Comment

        • Rose

          #5
          Re: Reference field in mult-record form

          Thanks... will keep this in mind.


          Comment

          • Rose

            #6
            Re: Reference field in mult-record form

            Believe it or not, I actually got it to work. I hate being so new to a
            programming language that I don't even know how to properly refer to it.
            Thanks for your response.

            "RobB" <ferndoc9@hotma il.com> wrote in message
            news:1116002285 .733876.293660@ g47g2000cwa.goo glegroups.com.. .[color=blue]
            > Rose wrote:[color=green]
            >> I want to use the javascript dom to reference the field of a record[/color]
            > in a[color=green]
            >> multi-record html form when that field has been changed. How do I[/color]
            > reference[color=green]
            >> the field? I have a JavaScript function coded as:
            >>
            >> var zownerID = document.updOwn ers.ownerID.val ue
            >> var zownerName = document.updOwn ers.ownerName.v alue
            >> document.updOwn ers.mysql_updat e.value = zownerID
            >> document.updOwn ers.newName.val ue = zownerName
            >>
            >> I have tried calling it from onclick for the submit button and[/color]
            > onsubmit for[color=green]
            >> the form with no success. Very new to javascript and would appreciate[/color]
            > any[color=green]
            >> help. Thanks[/color]
            >
            > Hi Rose.
            >
            > 'javascript dom' is a misnomer: the former is a scripting language, the
            > latter a language-independent object model.
            >
            > Not entirely clear what you're trying to do. Post your HTML along with
            > a description of what you need to happen.
            >[/color]


            Comment

            Working...