PDA

View Full Version : About number field value



naleen
8 Apr 2010, 9:07 PM
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){
}
})
}

mankz
8 Apr 2010, 9:23 PM
Post your code in CODE tags, very hard to read otherwise.

naleen
8 Apr 2010, 10:00 PM
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...

danguba
8 Apr 2010, 11:33 PM
I don't have any idea of code tags..

You can see how to use code tags here (http://www.extjs.com/forum/misc.php?do=bbcode#code). When you post code like you did its really impossible for anyone to even read it.

naleen
9 Apr 2010, 12:23 AM
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: '
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: '
echo $langVarsIndex['ProductId'] ',
name: 'id',
anchor:'70%',
allowBlank:false,
readOnly:true
},{
fieldLabel: '
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:'--
echo $langVarsIndex['SelectCategory'] --',
readOnly: true,
allowBlank:false,
labelSeparator : '',
anchor:'70%'
},


$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();
}
}
},

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
},

}

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: '
echo $langVarsIndex['ProductQuantity'] ',
name: 'quantity',
anchor:'70%',
helpText:'Available quantity of this product',
allowBlank:false,
xtype:'numberfield',
labelSeparator : '',
emptyText: ''
},{
fieldLabel: '
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: '
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: '
echo $langVarsIndex['MetaDescription'] '
},{
fieldLabel: '
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: '
echo $langVarsGlobal['MetaKeyword'] '

}]
},{
items:[{
xtype:'panel',
id:'proimages',
height:'100',
width:'auto'
}]
},{
layout:'column',
items:[{
columnWidth:.5,
layout: 'form',
items: [{
fieldLabel: '
echo $langVarsIndex['IncludeTax'] ',
name: 'inc_tax',
xtype:'checkbox',
helpText:'Check/Uncheck to enable or disable',
labelSeparator : '',
inputValue:1,anchor:'10%',
checked:true
}, /*{
fieldLabel: '
//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: '
echo $langVarsIndex['FreeShipping'] ',
name: 'free_ship',
helpText:'Check/Uncheck to enable or disable',
xtype:'checkbox',
inputValue:1,anchor:'10%',
labelSeparator : ''
},*/{
fieldLabel: '
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] '][i]
echo $langVarsIndex['ProductAttribute'] [/size]',
colspan: 1
},{
[html] '
echo $langVarsIndex['MeasurementUnits'] '
},{
[html] '
echo $langVarsIndex['ProductValue'] '
},{
[html] '
echo $langVarsIndex['Showwithdetail'] '
},

for($i=1;$i[11;$i++){

echo "{
[html] '[i]".$langVarsIndex['Attribute']." $i[/b]'
},{
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: '
echo $langVarsGlobal['Save'] ',
buttonAlign: 'left',
handler:function(){
if(editProductForm.getForm().isValid()){
editProductForm.getForm().submit({
'productformupdate.php',
waitMsg:'
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('
echo $langVarsGlobal['Success'] ', '
echo $langVarsIndex['ProductUpdated'] !');
nav.remove(editProductPanel)
dispProducts(parid);
}
else
Ext.MessageBox.alert('
echo $langVarsGlobal['Success'] ', '
echo $langVarsIndex['Sorry'] !
echo $langVarsIndex['CouldnotUpdate'] !');
}
catch(err) {
Ext.MessageBox.alert('
echo $langVarsGlobal['ERROR'] ', '
echo $langVarsIndex[ 'Couldnotdecode'] ' );
}
},
failure:function(f,a){
Ext.MessageBox.alert('
echo $langVarsGlobal['ErrorMessage'].','.$langVarsIndex['Sorry'] . $langVarsIndex['CouldnotUpdate']');
}
})
}
else
{
Ext.MessageBox.alert('
echo $langVarsGlobal['ErrorMessage'] ','
echo $langVarsGlobal[ 'Pleasefilltherequiredfields'] ');
}
}
}]/*,[html]'Saperate attribute values with ( | ) for providing options on an attribute.'*/
}]
});
var editProductPanel = new Ext.Panel({
layout:'fit',
closable:true,
items:editProductForm,
id:'editProductsTab'
})
nav.remove('editProductsTab')
var newP = nav.add(editProductPanel)
newP.setTitle('
echo $langVarsIndex['EditProduct'] ')
nav.setActiveTab(newP);
Ext.Ajax.request({
'productformfill.php',
params: { pid:proid},
success:function(req){
eval(req.responseText)
},
failure:function(req){
}
})
}

naleen
9 Apr 2010, 12:26 AM
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: '
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: '
echo $langVarsIndex['ProductId'] ',
name: 'id',
anchor:'70%',
allowBlank:false,
readOnly:true
},{
fieldLabel: '
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:'--
echo $langVarsIndex['SelectCategory'] --',
readOnly: true,
allowBlank:false,
labelSeparator : '',
anchor:'70%'
},


$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();
}
}
},

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
},

}

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: '
echo $langVarsIndex['ProductQuantity'] ',
name: 'quantity',
anchor:'70%',
helpText:'Available quantity of this product',
allowBlank:false,
xtype:'numberfield',
labelSeparator : '',
emptyText: ''
},{
fieldLabel: '
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: '
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: '
echo $langVarsIndex['MetaDescription'] '
},{
fieldLabel: '
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: '
echo $langVarsGlobal['MetaKeyword'] '

}]
},{
items:[{
xtype:'panel',
id:'proimages',
height:'100',
width:'auto'
}]
},{
layout:'column',
items:[{
columnWidth:.5,
layout: 'form',
items: [{
fieldLabel: '
echo $langVarsIndex['IncludeTax'] ',
name: 'inc_tax',
xtype:'checkbox',
helpText:'Check/Uncheck to enable or disable',
labelSeparator : '',
inputValue:1,anchor:'10%',
checked:true
}, /*{
fieldLabel: '
//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: '
echo $langVarsIndex['FreeShipping'] ',
name: 'free_ship',
helpText:'Check/Uncheck to enable or disable',
xtype:'checkbox',
inputValue:1,anchor:'10%',
labelSeparator : ''
},*/{
fieldLabel: '
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] '][i]
echo $langVarsIndex['ProductAttribute'] [/size]',
colspan: 1
},{
[html] '
echo $langVarsIndex['MeasurementUnits'] '
},{
[html] '
echo $langVarsIndex['ProductValue'] '
},{
[html] '
echo $langVarsIndex['Showwithdetail'] '
},

for($i=1;$i[11;$i++){

echo "{
[html] '[i]".$langVarsIndex['Attribute']." $i[/b]'
},{
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: '
echo $langVarsGlobal['Save'] ',
buttonAlign: 'left',
handler:function(){
if(editProductForm.getForm().isValid()){
editProductForm.getForm().submit({
'productformupdate.php',
waitMsg:'
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('
echo $langVarsGlobal['Success'] ', '
echo $langVarsIndex['ProductUpdated'] !');
nav.remove(editProductPanel)
dispProducts(parid);
}
else
Ext.MessageBox.alert('
echo $langVarsGlobal['Success'] ', '
echo $langVarsIndex['Sorry'] !
echo $langVarsIndex['CouldnotUpdate'] !');
}
catch(err) {
Ext.MessageBox.alert('
echo $langVarsGlobal['ERROR'] ', '
echo $langVarsIndex[ 'Couldnotdecode'] ' );
}
},
failure:function(f,a){
Ext.MessageBox.alert('
echo $langVarsGlobal['ErrorMessage'].','.$langVarsIndex['Sorry'] . $langVarsIndex['CouldnotUpdate']');
}
})
}
else
{
Ext.MessageBox.alert('
echo $langVarsGlobal['ErrorMessage'] ','
echo $langVarsGlobal[ 'Pleasefilltherequiredfields'] ');
}
}
}]/*,[html]'Saperate attribute values with ( | ) for providing options on an attribute.'*/
}]
});
var editProductPanel = new Ext.Panel({
layout:'fit',
closable:true,
items:editProductForm,
id:'editProductsTab'
})
nav.remove('editProductsTab')
var newP = nav.add(editProductPanel)
newP.setTitle('
echo $langVarsIndex['EditProduct'] ')
nav.setActiveTab(newP);
Ext.Ajax.request({
'productformfill.php',
params: { pid:proid},
success:function(req){
eval(req.responseText)
},
failure:function(req){
}
})
}

mystix
10 Apr 2010, 7:53 AM
http://www.extjs.com/learn/Ext_Forum_Help#How_to_post_code_properly