Problem with onClick="function()"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rozx
    New Member
    • Apr 2007
    • 1

    Problem with onClick="function()"

    how to pass input value form a page into a database using this onClick function.
    <input type="button" name="save" value="SIMPAN" onClick="save_a ll()">
    i've tried a few times, each time i click the button, its work but the values were not insert into the database, its null!!

    this is my function save_all() look like:-

    <script language="JavaS cript" type="text/javascript">
    function simpan() {
    window.open("si gnDaftar.cfm");
    window.close();
    }
    </script>

    and signDaftar.cfm, supposed to be the action form which is contained
    CFML :-

    <cfquery name="InsertSya rikat" datasource = "#application.d sn#">
    insert into maklumat_syarik at (sykt_nama,...)
    values (

    <cfif IsDefined("form .namasykt") AND #form.namasykt# NEQ "">
    ('#form.namasyk t#')
    <cfelse>
    NULL
    </cfif>
    , ......
    )

    so, please somebody help me...thanks
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Welcome to TSDN.

    To have form variables on the action page, you need to post the form. All you have done is opened a window.

    If you want to post to a new window, set the target as "_BLANK". Change that button to a submit button. Specify the action in your form tag too.

    Post again if you still have problems.

    Hope that helps.

    Comment

    Working...