PDA

View Full Version : Trouble getting ExtJS input values to pass into php variables



affiliateWise
3 Jul 2012, 12:46 PM
Hey there, I am having some issues wrapping my head around this idea. I would appreciate any help that I can get.

The issue:
I am using Ext.JS 4 and working with a Card Layout. I have the cards all set up and the form complete, what I am trying to do is get the value that the user inputs on the card in the textfield and pass that into my php file that is supposed to hold the variable that corresponds with that input value so that I can pass the php variable within a web query string.



var aff_company_name ={
xtype:'textfield',
id: 'company_name',
fieldLabel:'Company Name',
name:'affiliate[company_name]',
value:'<?php echo $oExtForms->jsEscape($oAffiliate->company_name);?>',
maxLength: 64,
allowBlank: false,
regex: /[a-zA-Z0-9]+/,
blankText:'Enter your company name.',
};


This is what my php class looks like...I have changed it up quite a bit so its not finished


<?php
class affiliate{
public static $aFieldTypes = array(
'affiliate' => array(
'company_name' => 'text',
'address1' => 'text',
'address2' => 'text',
'terms' => 'text',
),
);

const table = 'affiliate';


//Constructor, setup instance
function affiliate($nId=null){
__contstruct();
$this->init($this, self::$aFieldTypes, 'affiliate');

if(!empty($nId))
$this->get((int)$nId);
}

// Query for affiliate by id
public function get($nId){
$this->id = $nId;
$this->getAffiliate();
}
}
?>


If someone could help me figure this out I would greatly appreciate it. Thanks.
Oh and the ext_forms() class just specifies Json_encode.

mitchellsimoens
6 Jul 2012, 2:29 PM
Why do you have your name as 'affiliate[company_name]'?

Have you looked at the network tab in dev tools to look at the request?

affiliateWise
8 Jul 2012, 5:51 PM
I have my name as 'affiliate[company_name]' because I was thinking that I would be able to reference that name through my affiliate class object which I have defined as $oAffiliate = new affiliate(); which is wrapped in php tags at the top of my card layout class, am I going about it the wrong way?