Object Expected in IE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Makito
    New Member
    • Sep 2007
    • 1

    Object Expected in IE

    Hi people,

    please, see if you can help me. I have an HTML code to perform some actions in my web page, and would like to add a function (in javascript) to update records by SQL statement in Oracle database.
    I have the function i want to call :

    Code:
    ...
    htp.p('
    <script type="text/javascript" language="JavaScript">
    <!--
    function _onclick_situacao_JP(f)
    {
            if (f.v_situacao.checked) {
               update reservas_www set situacao:="C" where id_reserva=c_reserva.id_reserva;
              COMMIT;
            }
            else {
               update reservas_www set situacao:=" " where id_reserva=c_reserva.id_reserva;
               COMMIT;
            }
    }
    
    -->
    </script>
    ');

    and html code where depending some conditions, i call the function:

    Code:
    ...
    ...
     if c_reserva.situacao=' ' or c_reserva.situacao is null then
                 htp.p('<td class="internaltablec">');
                    v_sit_JP :='C';
                    v_strqry_JP := 'update reservas_www set situacao= '' || v_sit_JP || '' where id_reserva=' || c_reserva.id_reserva;
                    htp.formCheckbox(cname=>'v_situacao', cvalue=>'', cattributes=>'onclick="_onclick_situacao_JP(this.form)"');
                 htp.p('</td>');
                end if;
    
    
    ...


    and the function to update the records:

    Code:
    ...
    htp.p('
    <script type="text/javascript" language="JavaScript">
    <!--
    function _onclick_situacao_JP(f)
    {
            if (f.v_situacao.checked) {
               update reservas_www set situacao:="C" where id_reserva=c_reserva.id_reserva;
              COMMIT;
            }
            else {
               update reservas_www set situacao:=" " where id_reserva=c_reserva.id_reserva;
               COMMIT;
            }
    }
    
    -->
    </script>
    ');
    When executing the page in IExplorer, i always receive a message saying that Object expected...

    Could be wrong syntax? Do i have to change something?

    Thanks,
    Marco
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to TSDN!

    The reason why you get the error is that Javascript cannot connect and update records in a database. For this purpose, I would suggest you try using AJAX as explained here.

    Comment

    Working...