1. #1
    Ext User
    Join Date
    Apr 2010
    Posts
    4
    Vote Rating
    0
    naleen is on a distinguished road

      0  

    Default About number field value

    About number field value


    I have developed a form where one button is also used to add manufacturer. while adding the product with its details every thing is fine but while editing the product value of bulk_price and bulk_discount price is displayed on manufacture name and manufacture description number field. I don't know what to do?

    here is the code...

    function editProducts(proid,parid){
    Ext.override(Ext.form.Field, {
    afterRender : function() {
    if(this.helpText){
    var label = findLabel(this);
    if(label)
    {
    var helpImage = label.createChild({
    tag: 'img',
    src: '../../images/tip-icon.png',
    style: 'margin-bottom: 0px; margin-left: 5px; padding: 0px;'
    });
    Ext.QuickTips.register({
    target: helpImage,
    title: '',
    text: this.helpText,
    enabled: true
    });
    }
    }
    Ext.form.Field.superclass.afterRender.call(this);
    this.initEvents();
    }
    });
    var findLabel = function(field) {
    var wrapDiv = null;
    var label = null;
    wrapDiv = field.getEl().up('div.x-form-item');
    if(wrapDiv)
    {
    label = wrapDiv.child('label');
    }
    if(label) {
    return label;
    }
    }

    var editProductForm = new Ext.FormPanel({
    layout:'table',
    border:true,
    frame:true,
    autoScroll:true,
    defaults: {
    bodyStyle:'padding:8px'
    },
    layoutConfig: {
    columns: 1,
    columnWidth:300
    },
    items: [{
    xtype:'fieldset',
    title: '<?php echo $langVarsIndex['EditProduct'] ?>',
    buttonAlign:'left',
    autoHeight:true,

    items: [{ layout:'form',
    defaultType: 'textfield',
    border:true,
    labelWidth:110,
    defaults:{width:800},
    items:[{
    fieldLabel: '',
    name: 'par_nam',
    hidden:true,
    anchor:'70%',
    labelSeparator : '',
    readOnly:true
    },{
    fieldLabel: '<?php echo $langVarsIndex['ProductId'] ?>',
    name: 'id',
    anchor:'70%',
    allowBlank:false,
    readOnly:true
    },{
    fieldLabel: '<?php echo $langVarsIndex['ParentCategory'] ?>',
    name: 'catParent',
    xtype: 'combo',
    helpText:'Select category for the product',
    store: catList1,
    mode:'local',
    triggerAction: 'all',
    displayField: 'cat_nam',
    valueField: 'cat_id',
    hiddenName: 'catParent',
    emptyText:'--<?php echo $langVarsIndex['SelectCategory'] ?>--',
    readOnly: true,
    allowBlank:false,
    labelSeparator : '',
    anchor:'70%'
    },
    <?php
    $i=0;
    foreach($myfieldsarr as $fld) {
    foreach ($fld as $key => $value) {
    if($i==2)$unit=$currencyUnit;
    if($i==7)$unit=$currencyUnit;
    if($i==8)$unit=$currencyUnit;
    elseif($i==3)$unit=$weightUnit;
    if($i==4)$hlp='Short description of the product';
    elseif($i==5)$hlp='Promotional line that you would like to use for your product';
    if($i==0)
    echo " {
    fieldLabel: '$value',
    name: '$key',
    helpText:'Name of product',
    anchor:'70%',
    labelSeparator : '',
    allowBlank:false,
    emptyText: ''
    },";


    elseif($i==6) { ?>
    {
    xtype:'button',
    text:'New Manufacturer',
    style:'margin:5px 0px 5px 135px',
    fieldLabel:'Click',
    tooltip:'Click to add new manufacturer. If the manufacturer is not in the manufacturer\'s dropdown box.',
    handler:function(){
    if(Ext.getCmp('manuname1').hidden==true){
    Ext.getCmp('manuname1').show();
    Ext.getCmp('manudescription1').show();
    Ext.getCmp('manulogo1').show();
    Ext.getCmp('manucomb1').hide();
    }else{
    Ext.getCmp('manuname1').hide();
    Ext.getCmp('manudescription1').hide();
    Ext.getCmp('manulogo1').hide();
    Ext.getCmp('manucomb1').show();
    }
    }
    },
    <?php echo " {
    fieldLabel: '$value',
    xtype: 'combo',
    store: fundList,
    mode:'local',
    helpText:'Manufacturer of this product',
    triggerAction: 'all',
    displayField: 'manufacturername',
    valueField: 'id',
    name: '$key',
    id:'manucomb1',
    hiddenName: '$key',
    emptyText:'--".$langVarsIndex['Select']." $value--',
    readOnly: true,
    labelSeparator : '',
    anchor:'70%'
    },";
    ?>
    {
    name:'manuname1',
    id:'manuname1',
    anchor:'60%',
    emptyText:'Manufacturer name',
    labelSeparator : '',
    hidden:true
    },{
    name:'manudescription1',
    id:'manudescription1',
    emptyText:'Manufacturer description ',
    anchor:'60%',
    xtype:'textarea',
    height:'100',
    labelSeparator : '',
    hidden:true
    },{
    name:'manulogo1',
    id:'manulogo1',
    anchor:'60%',
    xtype:'textfield',
    inputType:'file',
    labelSeparator : '',
    hidden:true
    },
    <?php }

    elseif($i==7)
    echo " {
    fieldLabel: '$value (".$unit.")',
    name: '$key',
    helpText:'Bulk Price of the Product',
    anchor:'70%',
    xtype:'numberfield',
    labelSeparator : '',
    allowBlank:true,
    emptyText: ''
    },";
    elseif($i==8)
    echo " {
    fieldLabel: '$value (".$unit.")',
    name: '$key',
    helpText:'Bulk Discount Price',
    anchor:'70%',
    xtype:'numberfield',
    labelSeparator : '',
    allowBlank:true,
    emptyText: ''
    },";
    elseif($i==4)
    echo " {
    fieldLabel: '$value',
    name: '$key',
    anchor:'82%',
    helpText:'$hlp',
    xtype:'htmleditor',
    height:200,
    labelSeparator : ''

    },";

    elseif($i==5)
    echo " {
    fieldLabel: '$value',
    name: '$key',
    anchor:'70%',
    helpText:'$hlp',
    xtype:'textarea',
    height:100,
    labelSeparator : '',
    allowBlank:false,
    emptyText: ''
    },";
    elseif($i!=2&&$i!=3)
    echo " {
    fieldLabel: '".str_replace("Original","",$value)."(".$currencyUnit.")',
    name: '$key',
    helpText:'Product ".str_replace("Original","",$value)."',
    anchor:'70%',
    xtype:'numberfield',
    labelSeparator : '',
    allowBlank:false,
    emptyText: ''
    },";
    else if($i==3)
    echo " {
    fieldLabel: '$value (".$unit.")',
    name: '$key',
    anchor:'70%',
    xtype:'numberfield',
    allowBlank:false,
    helpText:'Enter product $value',
    labelSeparator : '',
    emptyText: ''
    },";
    else
    echo " {
    fieldLabel: '$value (".$unit.")',
    name: '$key',
    anchor:'70%',
    helpText:'Product $value',
    xtype:'numberfield',
    labelSeparator : '',
    emptyText: ''
    },";
    }$i++;
    }
    ?>

    {
    fieldLabel: '<?php echo $langVarsIndex['ProductQuantity'] ?>',
    name: 'quantity',
    anchor:'70%',
    helpText:'Available quantity of this product',
    allowBlank:false,
    xtype:'numberfield',
    labelSeparator : '',
    emptyText: ''
    },{
    fieldLabel: '<?php echo $langVarsIndex['ProductCode'] ?>',
    name: 'code',
    anchor:'70%',
    helpText:'A unique code for this product. This should be unique for all products',
    allowBlank:false,
    labelSeparator : '',
    emptyText: ''
    },{
    fieldLabel: '<?php echo $langVarsIndex['MetaDescription'] ?>',
    name: 'meta_desc',
    anchor:'70%',
    helpText:'Description of your product to help search engines find it',
    height:100,
    xtype:'textarea',
    labelSeparator : '',
    allowBlank:false,
    emptyText: '<?php echo $langVarsIndex['MetaDescription'] ?>'
    },{
    fieldLabel: '<?php echo $langVarsIndex['MetaKeyword'] ?>',
    name: 'meta_keyword',
    anchor:'70%',
    helpText:'Keywords related to this product to help search engines find it',
    height:100,
    xtype:'textarea',
    labelSeparator : '',
    allowBlank:false,
    emptyText: '<?php echo $langVarsGlobal['MetaKeyword'] ?>'

    }]
    },{
    items:[{
    xtype:'panel',
    id:'proimages',
    height:'100',
    width:'auto'
    }]
    },{
    layout:'column',
    items:[{
    columnWidth:.5,
    layout: 'form',
    items: [{
    fieldLabel: '<?php echo $langVarsIndex['IncludeTax'] ?>',
    name: 'inc_tax',
    xtype:'checkbox',
    helpText:'Check/Uncheck to enable or disable',
    labelSeparator : '',
    inputValue:1,anchor:'10%',
    checked:true
    }, /*{
    fieldLabel: '<?php //echo $langVarsIndex['IncludeVat'] ?>',
    name: 'inc_vat',
    xtype:'checkbox',
    helpText:'Check/Uncheck to enable or disable',
    inputValue:1,
    anchor:'10%',
    labelSeparator : '',
    checked:true
    }*/]
    },{
    columnWidth:.5,
    layout: 'form',
    items: [/*{
    fieldLabel: '<?php echo $langVarsIndex['FreeShipping'] ?>',
    name: 'free_ship',
    helpText:'Check/Uncheck to enable or disable',
    xtype:'checkbox',
    inputValue:1,anchor:'10%',
    labelSeparator : ''
    },*/{
    fieldLabel: '<?php echo $langVarsIndex['Active'] ?>',
    name: 'status',
    xtype:'checkbox',
    helpText:'Check/Uncheck to enable or disable',
    inputValue:1,anchor:'10%',
    labelSeparator : '',
    checked:true
    }]
    }]
    },{
    layout:'table',
    labelWidth:250,
    hidden:true,
    layoutConfig: {
    columns: 5
    },
    items:[{
    html: '',
    rowspan: 1,
    labelWidth:250,
    layout:'fit'
    },{
    html: '<a href="javascript:void(0)" onclick="popUp(\'../pages/attrhelp.php\',400,150)"><img src="../../images/tip-icon.png" title="Click for more info.."/></a><font size="2"><i><?php echo $langVarsIndex['ProductAttribute'] ?></i><font>',
    colspan: 1
    },{
    html: '<font size="2"><i><?php echo $langVarsIndex['MeasurementUnits'] ?></i><font>'
    },{
    html: '<font size="2"><i><?php echo $langVarsIndex['ProductValue'] ?></i><font>'
    },{
    html: '<font size="2"><i><?php echo $langVarsIndex['Showwithdetail'] ?></i><font>'
    },
    <?PHP for($i=1;$i<11;$i++){

    echo "{
    html: '<font size=";echo "2"; echo "><i>".$langVarsIndex['Attribute']." $i</b><font>'
    },{
    width:200,
    name: 'pdt_field[$i]',
    xtype:'textfield'
    },{
    width:200,
    name: 'pdt_unit[$i]',
    xtype:'textfield'
    },{
    width:200,
    name: 'pdt_value[$i]',
    xtype:'textfield'
    },{
    name:'pdt_show[$i]',
    xtype:'checkbox',
    inputValue:1,
    checked:true
    }";
    if($i!=10)
    echo ",";
    }
    ?>
    ]
    }],
    buttons: [{
    text: '<?php echo $langVarsGlobal['Save'] ?>',
    buttonAlign: 'left',
    handler:function(){
    if(editProductForm.getForm().isValid()){
    editProductForm.getForm().submit({
    url:'productformupdate.php',
    waitMsg:'<?php echo $langVarsIndex['UpdatingValues'] ?>',
    success:function(form,action){
    try {
    var jsonData = Ext.util.JSON.decode(action.response.responseText);
    if(jsonData.success=='true'){
    fundList.reload();
    Ext.MessageBox.alert('<?php echo $langVarsGlobal['Success'] ?>', '<?php echo $langVarsIndex['ProductUpdated'] ?>!');
    nav.remove(editProductPanel)
    dispProducts(parid);
    }
    else
    Ext.MessageBox.alert('<?php echo $langVarsGlobal['Success'] ?>', '<?php echo $langVarsIndex['Sorry'] ?>! <?php echo $langVarsIndex['CouldnotUpdate'] ?>!');
    }
    catch(err) {
    Ext.MessageBox.alert('<?php echo $langVarsGlobal['ERROR'] ?>', '<?php echo $langVarsIndex[ 'Couldnotdecode'] ?>' );
    }
    },
    failure:function(f,a){
    Ext.MessageBox.alert('<?php echo $langVarsGlobal['ErrorMessage'].','.$langVarsIndex['Sorry'] . $langVarsIndex['CouldnotUpdate']?>');
    }
    })
    }
    else
    {
    Ext.MessageBox.alert('<?php echo $langVarsGlobal['ErrorMessage'] ?>','<?php echo $langVarsGlobal[ 'Pleasefilltherequiredfields'] ?>');
    }
    }
    }]/*,html:'<font size="2" style="padding-left:70px"><b>Saperate attribute values with ( | ) for providing options on an attribute.</b></font>'*/
    }]
    });
    var editProductPanel = new Ext.Panel({
    layout:'fit',
    closable:true,
    items:editProductForm,
    id:'editProductsTab'
    })
    nav.remove('editProductsTab')
    var newP = nav.add(editProductPanel)
    newP.setTitle('<?php echo $langVarsIndex['EditProduct'] ?>')
    nav.setActiveTab(newP);
    Ext.Ajax.request({
    url: 'productformfill.php',
    params: { pid:proid},
    success:function(req){
    eval(req.responseText)
    },
    failure:function(req){
    }
    })
    }
    Last edited by naleen; 8 Apr 2010 at 9:16 PM. Reason: Adding code on it

  2. #2
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,804
    Vote Rating
    133
    mankz is a splendid one to behold mankz is a splendid one to behold mankz is a splendid one to behold mankz is a splendid one to behold mankz is a splendid one to behold mankz is a splendid one to behold

      0  

    Default


    Post your code in CODE tags, very hard to read otherwise.

  3. #3
    Ext User
    Join Date
    Apr 2010
    Posts
    4
    Vote Rating
    0
    naleen is on a distinguished road

      0  

    Default About Code tags

    About Code tags


    I don't have any idea of code tags.. I just want to know that why my number field value is displayed on another number field which is displayed on button click..

    my field is displayed from the database as
    if($i==6)
    when the value is 6 it displays field to add manufacture name, description and logo

    and when ($i==7)
    it should display bulk_price

    similarly when($i==8)
    it should display bulk_discount_price

    but bulk_price and bulk_discount_price are displayed on manuname1 and manudescription1 which is unwanted.


    Pleas help...

  4. #4
    Sencha Premium Member danguba's Avatar
    Join Date
    Feb 2009
    Location
    Kragujevac, Serbia
    Posts
    383
    Vote Rating
    69
    danguba is a jewel in the rough danguba is a jewel in the rough danguba is a jewel in the rough

      0  

    Default


    Quote Originally Posted by naleen View Post
    I don't have any idea of code tags..
    You can see how to use code tags here. When you post code like you did its really impossible for anyone to even read it.
    All Best
    ---
    Željko Mitrović
    http://skitanja.blogspot.com/

    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." Martin Golding

  5. #5
    Ext User
    Join Date
    Apr 2010
    Posts
    4
    Vote Rating
    0
    naleen is on a distinguished road

      0  

    Default About Code tags

    About Code tags


    here are the code with code tags as far as I knew to convert
    please somebody help me to provide solution of my question

    function editProducts(proid,parid){
    Ext.override(Ext.form.Field, {
    afterRender : function() {
    if(this.helpText){
    var label = findLabel(this);
    if(label)
    {
    var helpImage = label.createChild({
    tag: 'img',
    src: '../../images/tip-icon.png',
    style: 'margin-bottom: 0px; margin-left: 5px; padding: 0px;'
    });
    Ext.QuickTips.register({
    target: helpImage,
    title: '',
    text: this.helpText,
    enabled: true
    });
    }
    }
    Ext.form.Field.superclass.afterRender.call(this);
    this.initEvents();
    }
    });
    var findLabel = function(field) {
    var wrapDiv = null;
    var label = null;
    wrapDiv = field.getEl().up('div.x-form-item');
    if(wrapDiv)
    {
    label = wrapDiv.child('label');
    }
    if(label) {
    return label;
    }
    }

    var editProductForm = new Ext.FormPanel({
    layout:'table',
    border:true,
    frame:true,
    autoScroll:true,
    defaults: {
    bodyStyle:'padding:8px'
    },
    layoutConfig: {
    columns: 1,
    columnWidth:300
    },
    items: [{
    xtype:'fieldset',
    title: '
    PHP Code:
     echo $langVarsIndex['EditProduct'
    ',
    buttonAlign:'left',
    autoHeight:true,

    items: [{ layout:'form',
    defaultType: 'textfield',
    border:true,
    labelWidth:110,
    defaults:{width:800},
    items:[{
    fieldLabel: '',
    name: 'par_nam',
    hidden:true,
    anchor:'70%',
    labelSeparator : '',
    readOnly:true
    },{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['ProductId'
    ',
    name: 'id',
    anchor:'70%',
    allowBlank:false,
    readOnly:true
    },{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['ParentCategory'
    ',
    name: 'catParent',
    xtype: 'combo',
    helpText:'Select category for the product',
    store: catList1,
    mode:'local',
    triggerAction: 'all',
    displayField: 'cat_nam',
    valueField: 'cat_id',
    hiddenName: 'catParent',
    emptyText:'--
    PHP Code:
     echo $langVarsIndex['SelectCategory'
    --',
    readOnly: true,
    allowBlank:false,
    labelSeparator : '',
    anchor:'70%'
    },
    PHP Code:
                    $i=0;
                    foreach(
    $myfieldsarr as $fld) {
                foreach (
    $fld  as $key =] $value) {
                    if(
    $i==2)$unit=$currencyUnit;
                    if(
    $i==7)$unit=$currencyUnit;
                    if(
    $i==8)$unit=$currencyUnit;
                elseif(
    $i==3)$unit=$weightUnit;
                    if(
    $i==4)$hlp='Short description of the product';
                elseif(
    $i==5)$hlp='Promotional line that you would like to use for your product';
                if(
    $i==0)
                echo 
    " {  
                        fieldLabel: '
    $value',
                        name: '
    $key',
                        helpText:'Name of product',
                        anchor:'70%',
                        labelSeparator : '',
                        allowBlank:false,
                        emptyText: ''
                    },"


                    
                elseif(
    $i==6) { 
    {
    xtype:'button',
    text:'New Manufacturer',
    style:'margin:5px 0px 5px 135px',
    fieldLabel:'Click',
    tooltip:'Click to add new manufacturer. If the manufacturer is not in the manufacturer\'s dropdown box.',
    handler:function(){
    if(Ext.getCmp('manuname1').hidden==true){
    Ext.getCmp('manuname1').show();
    Ext.getCmp('manudescription1').show();
    Ext.getCmp('manulogo1').show();
    Ext.getCmp('manucomb1').hide();
    }else{
    Ext.getCmp('manuname1').hide();
    Ext.getCmp('manudescription1').hide();
    Ext.getCmp('manulogo1').hide();
    Ext.getCmp('manucomb1').show();
    }
    }
    },
    PHP Code:
        echo " {
                    fieldLabel: '
    $value',
                    xtype: 'combo',
                    store: fundList,
                    mode:'local',
                    helpText:'Manufacturer of this product',
                    triggerAction: 'all',
                    displayField: 'manufacturername',
                    valueField: 'id',
                    name: '
    $key',
                    id:'manucomb1',
                    hiddenName: '
    $key',
                    emptyText:'--"
    .$langVarsIndex['Select'].$value--',
                    readOnly: true,
                    labelSeparator : '',
                    anchor:'70%'
                    },"

    {
    name:'manuname1',
    id:'manuname1',
    anchor:'60%',
    emptyText:'Manufacturer name',
    labelSeparator : '',
    hidden:true
    },{
    name:'manudescription1',

    id:'manudescription1',
    emptyText:'Manufacturer description ',
    anchor:'60%',
    xtype:'textarea',
    height:'100',
    labelSeparator : '',
    hidden:true
    },{
    name:'manulogo1',
    id:'manulogo1',
    anchor:'60%',
    xtype:'textfield',
    inputType:'file',
    labelSeparator : '',
    hidden:true
    },
    PHP Code:
      }

                    elseif(
    $i==7)
                    echo 
    " {  
                        fieldLabel: '
    $value (".$unit.")',
                        name: '
    $key',
                        helpText:'Bulk Price of the Product',
                        anchor:'70%',
                        xtype:'numberfield',
                        labelSeparator : '',
                        allowBlank:true,
                        emptyText: ''
                    },"

                    elseif(
    $i==8)
                    echo 
    " {  
                        fieldLabel: '
    $value (".$unit.")',
                        name: '
    $key',
                        helpText:'Bulk Discount Price of the product',
                        anchor:'70%',
                        xtype:'numberfield',
                        labelSeparator : '',
                        allowBlank:true,
                        emptyText: ''
                    },"

                    elseif(
    $i==4)
                    echo 
    " {  
                        fieldLabel: '
    $value',
                        name: '
    $key',                    
                        anchor:'82%',
                        helpText:'
    $hlp',
                        xtype:'htmleditor',
                        height:200,
                        labelSeparator : ''
                        
                    },"

                    
                    elseif(
    $i==5)
                    echo 
    " {  
                        fieldLabel: '
    $value',
                        name: '
    $key',
                        anchor:'70%',
                        helpText:'
    $hlp',
                        xtype:'textarea',
                        height:100,
                        labelSeparator : '',
                        allowBlank:false,
                        emptyText: ''
                    },"

                    elseif(
    $i!=2&&$i!=3)
                    echo 
    " {  
                        fieldLabel: '"
    .str_replace("Original","",$value)."(".$currencyUnit.")',
                        name: '
    $key',
                        helpText:'Product "
    .str_replace("Original","",$value)."',
                        anchor:'70%',
                        xtype:'numberfield',
                        labelSeparator : '',
                        allowBlank:false,
                        emptyText: ''
                    },"
    ;
                    else if(
    $i==3)
                        echo 
    " {  
                            fieldLabel: '
    $value (".$unit.")',
                            name: '
    $key',
                            anchor:'70%',
                            xtype:'numberfield',
                            allowBlank:false,
                            helpText:'Enter product  
    $value',
                            labelSeparator : '',
                            emptyText: ''
                        },"

                    else
                    echo 
    " {  
                        fieldLabel: '
    $value (".$unit.")',
                        name: '
    $key',
                        anchor:'70%',
                        helpText:'Product 
    $value',
                        xtype:'numberfield',
                        labelSeparator : '',
                        emptyText: ''
                    },"

                                }
    $i++;
                                } 
    {
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['ProductQuantity'
    ',
    name: 'quantity',
    anchor:'70%',
    helpText:'Available quantity of this product',
    allowBlank:false,
    xtype:'numberfield',
    labelSeparator : '',
    emptyText: ''
    },{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['ProductCode'
    ',
    name: 'code',
    anchor:'70%',
    helpText:'A unique code for this product. This should be unique for all products',
    allowBlank:false,
    labelSeparator : '',
    emptyText: ''
    },{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['MetaDescription'
    ',
    name: 'meta_desc',
    anchor:'70%',
    helpText:'Description of your product to help search engines find it',
    height:100,
    xtype:'textarea',
    labelSeparator : '',
    allowBlank:false,
    emptyText: '
    PHP Code:
     echo $langVarsIndex['MetaDescription'
    '
    },{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['MetaKeyword'
    ',
    name: 'meta_keyword',
    anchor:'70%',
    helpText:'Keywords related to this product to help search engines find it',
    height:100,
    xtype:'textarea',
    labelSeparator : '',
    allowBlank:false,
    emptyText: '
    PHP Code:
     echo $langVarsGlobal['MetaKeyword'
    '

    }]
    },{
    items:[{
    xtype:'panel',
    id:'proimages',
    height:'100',
    width:'auto'
    }]
    },{
    layout:'column',
    items:[{
    columnWidth:.5,
    layout: 'form',
    items: [{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['IncludeTax'
    ',
    name: 'inc_tax',
    xtype:'checkbox',
    helpText:'Check/Uncheck to enable or disable',
    labelSeparator : '',
    inputValue:1,anchor:'10%',
    checked:true
    }, /*{
    fieldLabel: '
    PHP Code:
     //echo $langVarsIndex['IncludeVat'] 
    ',
    name: 'inc_vat',
    xtype:'checkbox',
    helpText:'Check/Uncheck to enable or disable',
    inputValue:1,
    anchor:'10%',
    labelSeparator : '',
    checked:true
    }*/]
    },{
    columnWidth:.5,
    layout: 'form',
    items: [/*{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['FreeShipping'
    ',
    name: 'free_ship',
    helpText:'Check/Uncheck to enable or disable',
    xtype:'checkbox',
    inputValue:1,anchor:'10%',
    labelSeparator : ''
    },*/{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['Active'
    ',
    name: 'status',
    xtype:'checkbox',
    helpText:'Check/Uncheck to enable or disable',
    inputValue:1,anchor:'10%',
    labelSeparator : '',
    checked:true
    }]
    }]
    },{
    layout:'table',
    labelWidth:250,
    hidden:true,
    layoutConfig: {
    columns: 5
    },
    items:[{
    [html] '',
    rowspan: 1,
    labelWidth:250,
    layout:'fit'
    },{
    [html] '[a href="javascript:void(0)" onclick="popUp(\'../pages/attrhelp.php\',400,150)"][img src="../../images/tip-icon.png" title="Click for more info.."/][/a][font ]
    PHP Code:
     echo                        $langVarsIndex['ProductAttribute'
    [/font]',
    colspan: 1
    },{
    [html] '[font size="2"]
    PHP Code:
     echo $langVarsIndex['MeasurementUnits'
    [/font]'
    },{
    [html] '[font size="2"]
    PHP Code:
     echo $langVarsIndex['ProductValue'
    [/font]'
    },{
    [html] '[font size="2"]
    PHP Code:
     echo $langVarsIndex['Showwithdetail'
    [/font]'
    },
    PHP Code:
     for($i=1;$i[11;$i++){

                            echo 
    "{
                            [html] '[font size="
    ;echo "2"; echo "][i]".$langVarsIndex['Attribute'].$i[/b][/font]'
                        },{
                            width:200,
                            name: 'pdt_field[
    $i]',
                            xtype:'textfield'
                        },{
                            width:200,
                            name: 'pdt_unit[
    $i]',
                            xtype:'textfield'
                        },{
                            width:200,
                            name: 'pdt_value[
    $i]',
                            xtype:'textfield'
                        },{
                        name:'pdt_show[
    $i]',
                        xtype:'checkbox',
                        inputValue:1,
                        checked:true
                        }"
    ;
                        if(
    $i!=10)
                        echo 
    ",";
                        } 
    ]
    }],
    buttons: [{
    text: '
    PHP Code:
     echo $langVarsGlobal['Save'
    ',
    buttonAlign: 'left',
    handler:function(){
    if(editProductForm.getForm().isValid()){
    editProductForm.getForm().submit({
    'productformupdate.php',
    waitMsg:'
    PHP Code:
     echo $langVarsIndex['UpdatingValues'
    ',
    success:function(form,action){
    try {
    var jsonData = Ext.util.JSON.decode(action.response.responseText);
    if(jsonData.success=='true'){
    fundList.reload();
    Ext.MessageBox.alert('
    PHP Code:
     echo $langVarsGlobal['Success'
    ', '
    PHP Code:
     echo                                    $langVarsIndex['ProductUpdated'
    !');
    nav.remove(editProductPanel)
    dispProducts(parid);
    }
    else
    Ext.MessageBox.alert('
    PHP Code:
     echo $langVarsGlobal['Success'
    ', '
    PHP Code:
     echo                                    $langVarsIndex['Sorry'
    !
    PHP Code:
     echo $langVarsIndex['CouldnotUpdate'
    !');
    }
    catch(err) {
    Ext.MessageBox.alert('
    PHP Code:
     echo $langVarsGlobal['ERROR'
    ', '
    PHP Code:
     echo $langVarsIndex[                        'Couldnotdecode'
    ' );
    }
    },
    failure:function(f,a){
    Ext.MessageBox.alert('
    PHP Code:
     echo $langVarsGlobal['ErrorMessage'].','.$langVarsIndex['Sorry']                            . $langVarsIndex['CouldnotUpdate'
    ');
    }
    })
    }
    else
    {
    Ext.MessageBox.alert('
    PHP Code:
     echo $langVarsGlobal['ErrorMessage'
    ','
    PHP Code:
     echo $langVarsGlobal[                 'Pleasefilltherequiredfields'
    ');
    }
    }
    }]/*,[html]'[font size="2" style="padding-left:70px"]Saperate attribute values with ( | ) for providing options on an attribute.[/font]'*/
    }]
    });
    var editProductPanel = new Ext.Panel({
    layout:'fit',
    closable:true,
    items:editProductForm,
    id:'editProductsTab'
    })
    nav.remove('editProductsTab')
    var newP = nav.add(editProductPanel)
    newP.setTitle('
    PHP Code:
     echo $langVarsIndex['EditProduct'
    ')
    nav.setActiveTab(newP);
    Ext.Ajax.request({
    'productformfill.php',
    params: { pid:proid},
    success:function(req){
    eval(req.responseText)
    },
    failure:function(req){
    }
    })
    }

  6. #6
    Ext User
    Join Date
    Apr 2010
    Posts
    4
    Vote Rating
    0
    naleen is on a distinguished road

      0  

    Default


    now please somebody help me to solve my issue..

    Here is the code with code tags as far as I can convert

    function editProducts(proid,parid){
    Ext.override(Ext.form.Field, {
    afterRender : function() {
    if(this.helpText){
    var label = findLabel(this);
    if(label)
    {
    var helpImage = label.createChild({
    tag: 'img',
    src: '../../images/tip-icon.png',
    style: 'margin-bottom: 0px; margin-left: 5px; padding: 0px;'
    });
    Ext.QuickTips.register({
    target: helpImage,
    title: '',
    text: this.helpText,
    enabled: true
    });
    }
    }
    Ext.form.Field.superclass.afterRender.call(this);
    this.initEvents();
    }
    });
    var findLabel = function(field) {
    var wrapDiv = null;
    var label = null;
    wrapDiv = field.getEl().up('div.x-form-item');
    if(wrapDiv)
    {
    label = wrapDiv.child('label');
    }
    if(label) {
    return label;
    }
    }

    var editProductForm = new Ext.FormPanel({
    layout:'table',
    border:true,
    frame:true,
    autoScroll:true,
    defaults: {
    bodyStyle:'padding:8px'
    },
    layoutConfig: {
    columns: 1,
    columnWidth:300
    },
    items: [{
    xtype:'fieldset',
    title: '
    PHP Code:
     echo $langVarsIndex['EditProduct'
    ',
    buttonAlign:'left',
    autoHeight:true,

    items: [{ layout:'form',
    defaultType: 'textfield',
    border:true,
    labelWidth:110,
    defaults:{width:800},
    items:[{
    fieldLabel: '',
    name: 'par_nam',
    hidden:true,
    anchor:'70%',
    labelSeparator : '',
    readOnly:true
    },{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['ProductId'
    ',
    name: 'id',
    anchor:'70%',
    allowBlank:false,
    readOnly:true
    },{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['ParentCategory'
    ',
    name: 'catParent',
    xtype: 'combo',
    helpText:'Select category for the product',
    store: catList1,
    mode:'local',
    triggerAction: 'all',
    displayField: 'cat_nam',
    valueField: 'cat_id',
    hiddenName: 'catParent',
    emptyText:'--
    PHP Code:
     echo $langVarsIndex['SelectCategory'
    --',
    readOnly: true,
    allowBlank:false,
    labelSeparator : '',
    anchor:'70%'
    },
    PHP Code:
                    $i=0;
                    foreach(
    $myfieldsarr as $fld) {
                foreach (
    $fld  as $key =] $value) {
                    if(
    $i==2)$unit=$currencyUnit;
                    if(
    $i==7)$unit=$currencyUnit;
                    if(
    $i==8)$unit=$currencyUnit;
                elseif(
    $i==3)$unit=$weightUnit;
                    if(
    $i==4)$hlp='Short description of the product';
                elseif(
    $i==5)$hlp='Promotional line that you would like to use for your product';
                if(
    $i==0)
                echo 
    " {  
                        fieldLabel: '
    $value',
                        name: '
    $key',
                        helpText:'Name of product',
                        anchor:'70%',
                        labelSeparator : '',
                        allowBlank:false,
                        emptyText: ''
                    },"


                    
                elseif(
    $i==6) { 
    {
    xtype:'button',
    text:'New Manufacturer',
    style:'margin:5px 0px 5px 135px',
    fieldLabel:'Click',
    tooltip:'Click to add new manufacturer. If the manufacturer is not in the manufacturer\'s dropdown box.',
    handler:function(){
    if(Ext.getCmp('manuname1').hidden==true){
    Ext.getCmp('manuname1').show();
    Ext.getCmp('manudescription1').show();
    Ext.getCmp('manulogo1').show();
    Ext.getCmp('manucomb1').hide();
    }else{
    Ext.getCmp('manuname1').hide();
    Ext.getCmp('manudescription1').hide();
    Ext.getCmp('manulogo1').hide();
    Ext.getCmp('manucomb1').show();
    }
    }
    },
    PHP Code:
        echo " {
                    fieldLabel: '
    $value',
                    xtype: 'combo',
                    store: fundList,
                    mode:'local',
                    helpText:'Manufacturer of this product',
                    triggerAction: 'all',
                    displayField: 'manufacturername',
                    valueField: 'id',
                    name: '
    $key',
                    id:'manucomb1',
                    hiddenName: '
    $key',
                    emptyText:'--"
    .$langVarsIndex['Select'].$value--',
                    readOnly: true,
                    labelSeparator : '',
                    anchor:'70%'
                    },"

    {
    name:'manuname1',
    id:'manuname1',
    anchor:'60%',
    emptyText:'Manufacturer name',
    labelSeparator : '',
    hidden:true
    },{
    name:'manudescription1',

    id:'manudescription1',
    emptyText:'Manufacturer description ',
    anchor:'60%',
    xtype:'textarea',
    height:'100',
    labelSeparator : '',
    hidden:true
    },{
    name:'manulogo1',
    id:'manulogo1',
    anchor:'60%',
    xtype:'textfield',
    inputType:'file',
    labelSeparator : '',
    hidden:true
    },
    PHP Code:
      }

                    elseif(
    $i==7)
                    echo 
    " {  
                        fieldLabel: '
    $value (".$unit.")',
                        name: '
    $key',
                        helpText:'Bulk Price of the Product',
                        anchor:'70%',
                        xtype:'numberfield',
                        labelSeparator : '',
                        allowBlank:true,
                        emptyText: ''
                    },"

                    elseif(
    $i==8)
                    echo 
    " {  
                        fieldLabel: '
    $value (".$unit.")',
                        name: '
    $key',
                        helpText:'Bulk Discount Price of the product',
                        anchor:'70%',
                        xtype:'numberfield',
                        labelSeparator : '',
                        allowBlank:true,
                        emptyText: ''
                    },"

                    elseif(
    $i==4)
                    echo 
    " {  
                        fieldLabel: '
    $value',
                        name: '
    $key',                    
                        anchor:'82%',
                        helpText:'
    $hlp',
                        xtype:'htmleditor',
                        height:200,
                        labelSeparator : ''
                        
                    },"

                    
                    elseif(
    $i==5)
                    echo 
    " {  
                        fieldLabel: '
    $value',
                        name: '
    $key',
                        anchor:'70%',
                        helpText:'
    $hlp',
                        xtype:'textarea',
                        height:100,
                        labelSeparator : '',
                        allowBlank:false,
                        emptyText: ''
                    },"

                    elseif(
    $i!=2&&$i!=3)
                    echo 
    " {  
                        fieldLabel: '"
    .str_replace("Original","",$value)."(".$currencyUnit.")',
                        name: '
    $key',
                        helpText:'Product "
    .str_replace("Original","",$value)."',
                        anchor:'70%',
                        xtype:'numberfield',
                        labelSeparator : '',
                        allowBlank:false,
                        emptyText: ''
                    },"
    ;
                    else if(
    $i==3)
                        echo 
    " {  
                            fieldLabel: '
    $value (".$unit.")',
                            name: '
    $key',
                            anchor:'70%',
                            xtype:'numberfield',
                            allowBlank:false,
                            helpText:'Enter product  
    $value',
                            labelSeparator : '',
                            emptyText: ''
                        },"

                    else
                    echo 
    " {  
                        fieldLabel: '
    $value (".$unit.")',
                        name: '
    $key',
                        anchor:'70%',
                        helpText:'Product 
    $value',
                        xtype:'numberfield',
                        labelSeparator : '',
                        emptyText: ''
                    },"

                                }
    $i++;
                                } 
    {
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['ProductQuantity'
    ',
    name: 'quantity',
    anchor:'70%',
    helpText:'Available quantity of this product',
    allowBlank:false,
    xtype:'numberfield',
    labelSeparator : '',
    emptyText: ''
    },{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['ProductCode'
    ',
    name: 'code',
    anchor:'70%',
    helpText:'A unique code for this product. This should be unique for all products',
    allowBlank:false,
    labelSeparator : '',
    emptyText: ''
    },{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['MetaDescription'
    ',
    name: 'meta_desc',
    anchor:'70%',
    helpText:'Description of your product to help search engines find it',
    height:100,
    xtype:'textarea',
    labelSeparator : '',
    allowBlank:false,
    emptyText: '
    PHP Code:
     echo $langVarsIndex['MetaDescription'
    '
    },{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['MetaKeyword'
    ',
    name: 'meta_keyword',
    anchor:'70%',
    helpText:'Keywords related to this product to help search engines find it',
    height:100,
    xtype:'textarea',
    labelSeparator : '',
    allowBlank:false,
    emptyText: '
    PHP Code:
     echo $langVarsGlobal['MetaKeyword'
    '

    }]
    },{
    items:[{
    xtype:'panel',
    id:'proimages',
    height:'100',
    width:'auto'
    }]
    },{
    layout:'column',
    items:[{
    columnWidth:.5,
    layout: 'form',
    items: [{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['IncludeTax'
    ',
    name: 'inc_tax',
    xtype:'checkbox',
    helpText:'Check/Uncheck to enable or disable',
    labelSeparator : '',
    inputValue:1,anchor:'10%',
    checked:true
    }, /*{
    fieldLabel: '
    PHP Code:
     //echo $langVarsIndex['IncludeVat'] 
    ',
    name: 'inc_vat',
    xtype:'checkbox',
    helpText:'Check/Uncheck to enable or disable',
    inputValue:1,
    anchor:'10%',
    labelSeparator : '',
    checked:true
    }*/]
    },{
    columnWidth:.5,
    layout: 'form',
    items: [/*{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['FreeShipping'
    ',
    name: 'free_ship',
    helpText:'Check/Uncheck to enable or disable',
    xtype:'checkbox',
    inputValue:1,anchor:'10%',
    labelSeparator : ''
    },*/{
    fieldLabel: '
    PHP Code:
     echo $langVarsIndex['Active'
    ',
    name: 'status',
    xtype:'checkbox',
    helpText:'Check/Uncheck to enable or disable',
    inputValue:1,anchor:'10%',
    labelSeparator : '',
    checked:true
    }]
    }]
    },{
    layout:'table',
    labelWidth:250,
    hidden:true,
    layoutConfig: {
    columns: 5
    },
    items:[{
    [html] '',
    rowspan: 1,
    labelWidth:250,
    layout:'fit'
    },{
    [html] '[a href="javascript:void(0)" onclick="popUp(\'../pages/attrhelp.php\',400,150)"][img src="../../images/tip-icon.png" title="Click for more info.."/][/a][font ]
    PHP Code:
     echo                        $langVarsIndex['ProductAttribute'
    [/font]',
    colspan: 1
    },{
    [html] '[font size="2"]
    PHP Code:
     echo $langVarsIndex['MeasurementUnits'
    [/font]'
    },{
    [html] '[font size="2"]
    PHP Code:
     echo $langVarsIndex['ProductValue'
    [/font]'
    },{
    [html] '[font size="2"]
    PHP Code:
     echo $langVarsIndex['Showwithdetail'
    [/font]'
    },
    PHP Code:
     for($i=1;$i[11;$i++){

                            echo 
    "{
                            [html] '[font size="
    ;echo "2"; echo "][i]".$langVarsIndex['Attribute'].$i[/b][/font]'
                        },{
                            width:200,
                            name: 'pdt_field[
    $i]',
                            xtype:'textfield'
                        },{
                            width:200,
                            name: 'pdt_unit[
    $i]',
                            xtype:'textfield'
                        },{
                            width:200,
                            name: 'pdt_value[
    $i]',
                            xtype:'textfield'
                        },{
                        name:'pdt_show[
    $i]',
                        xtype:'checkbox',
                        inputValue:1,
                        checked:true
                        }"
    ;
                        if(
    $i!=10)
                        echo 
    ",";
                        } 
    ]
    }],
    buttons: [{
    text: '
    PHP Code:
     echo $langVarsGlobal['Save'
    ',
    buttonAlign: 'left',
    handler:function(){
    if(editProductForm.getForm().isValid()){
    editProductForm.getForm().submit({
    'productformupdate.php',
    waitMsg:'
    PHP Code:
     echo $langVarsIndex['UpdatingValues'
    ',
    success:function(form,action){
    try {
    var jsonData = Ext.util.JSON.decode(action.response.responseText);
    if(jsonData.success=='true'){
    fundList.reload();
    Ext.MessageBox.alert('
    PHP Code:
     echo $langVarsGlobal['Success'
    ', '
    PHP Code:
     echo                                    $langVarsIndex['ProductUpdated'
    !');
    nav.remove(editProductPanel)
    dispProducts(parid);
    }
    else
    Ext.MessageBox.alert('
    PHP Code:
     echo $langVarsGlobal['Success'
    ', '
    PHP Code:
     echo                                    $langVarsIndex['Sorry'
    !
    PHP Code:
     echo $langVarsIndex['CouldnotUpdate'
    !');
    }
    catch(err) {
    Ext.MessageBox.alert('
    PHP Code:
     echo $langVarsGlobal['ERROR'
    ', '
    PHP Code:
     echo $langVarsIndex[                        'Couldnotdecode'
    ' );
    }
    },
    failure:function(f,a){
    Ext.MessageBox.alert('
    PHP Code:
     echo $langVarsGlobal['ErrorMessage'].','.$langVarsIndex['Sorry']                            . $langVarsIndex['CouldnotUpdate'
    ');
    }
    })
    }
    else
    {
    Ext.MessageBox.alert('
    PHP Code:
     echo $langVarsGlobal['ErrorMessage'
    ','
    PHP Code:
     echo $langVarsGlobal[                 'Pleasefilltherequiredfields'
    ');
    }
    }
    }]/*,[html]'[font size="2" style="padding-left:70px"]Saperate attribute values with ( | ) for providing options on an attribute.[/font]'*/
    }]
    });
    var editProductPanel = new Ext.Panel({
    layout:'fit',
    closable:true,
    items:editProductForm,
    id:'editProductsTab'
    })
    nav.remove('editProductsTab')
    var newP = nav.add(editProductPanel)
    newP.setTitle('
    PHP Code:
     echo $langVarsIndex['EditProduct'
    ')
    nav.setActiveTab(newP);
    Ext.Ajax.request({
    'productformfill.php',
    params: { pid:proid},
    success:function(req){
    eval(req.responseText)
    },
    failure:function(req){
    }
    })
    }

  7. #7
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

Thread Participants: 3