1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    49
    Vote Rating
    0
    zakif is on a distinguished road

      0  

    Default Sending var value from Add Value button

    Sending var value from Add Value button


    I have a table whose primary key is in varchar. I have form in extJS and process the inputted value on PHP file.

    In ExtJS grid, I have to set some values to differentiate whether the form is for Add value (new data) or Edit value (update data). I've tried the value (var actiontype) to send to PHP file when I clicked the Add Value button. Here is the code for tbar in js file:

    Code:
    tbar: [
                {
                text:'Add Value',
                icon: 'img/table_add.png',
                scope:this,
                handler:function(){
                    var getFormWindow = new applabel_TypeSiteFormWindow(applabel_store);
                    var actiontype = 1;
                    getFormWindow.getFormPanel().getForm().reset();
                    getFormWindow.show();
                }
            },
    And here is the PHP code:

    Code:
    $field_value = array(
                        "id_one"=>$_POST["id_one"], //id_one is in varchar data type
                        "id_two"=>$_POST["id_two"],
                        "txt"=>$_POST["txt"]
                    );
                
    if($_GET["actiontype"]==1){                
                    $db->insert("tb_label", $field_value);   
                }else if ($_POST["actiontype"]==2){                
                    $db->update("tb_label", $field_value,"id_one = '".$_POST["id_one"]."' and id_two = '".$_POST["id_two"]."'");                
                                }

    I got Successfully saved alert message, but somehow the data aren't added into database.

    Any solution how to fix that? Thanks in advance.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Vote Rating
    751
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Where do you send the request in relation to the button handler?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    49
    Vote Rating
    0
    zakif is on a distinguished road

      0  

    Default [SOLVED] Add xtype hidden to form

    [SOLVED] Add xtype hidden to form


    Thanks for your reply, mitchell.

    It was just solved.

    It turns out I only have to add xtype hidden (e.g. name: action) and set the value (e.g. 'edit' or '1') on form panel (in js file). Furthermore, I have to create if-else condition on PHP file considering the hidden field.

    IF ($_POST["actiontype"]=='1') { edit/update process } ELSE{ add/create process }.

    By using the hidden field, the set value only send to rowclick action (edit/update process), not to create new (Add value) data.

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar