ayeng 0 Newbie Poster

Hi, I need help!

I want my textbox value to be change using jquery in cakephp during onchange event of my textbox.

below is my add.ctp code:

<div class="jobs form">
<?php echo $this->Form->create('Job', array('type'=>'file')); ?>
        <legend><?php echo __('Add Job'); ?></legend>

        echo $this->Html->script('ckeditor/ckeditor');
        echo $this->Form->input('users_id');
        echo $this->Form->input('comp_name', array('label' => 'Company Name'));
        echo $this->Form->input('title');
        echo $this->Form->input('category_id');
        echo $this->Form->input('subcategory_id');
        echo $this->Html->image('../', array('width' => '250', 'height' => '120', 'id' => 'UserLogo'));
        echo $this->Form->input('filename', array('type' => 'file', 'label' => 'Logo'));
        echo $this->Form->input('content', array('class' => 'ckeditor'));
        echo $this->Form->input('email');
    echo $this->Form->submit('Submit');
), array(
    'async' => true,
    'method' => 'POST',
    'data'=> $this->Js->serializeForm(array(
            'isForm' => true,
            'inline' => true

my controllers code:

public function getEmail() {
        if( $this->request->is('ajax') ) {
            $usrId = $this->request->data['Job']['users_id'];
            $data = $this->User->find('first', array('conditions' => array('User.id' => $usrId), 'fields' => array('User.email'), 'recursive' => -1));
            $this->set('JobEmail', $data);
            $this->layout = 'ajax';

my get_Email.ctp code:

<?php foreach ($JobEmail as $email): ?>
    <input value="<?php echo $email['email']; ?>">
<?php endforeach; ?>

I wonder why it's not working with above using textbox.

I tried set my form to this - echo $this->Form->input('email', array('type'='select'));

and in my get_Email.ctp to this - <?php foreach ($JobEmail as $email): ?> <option value="<?php echo $email['email']; ?>"><?php echo $email['email']; ?></option> <?php endforeach; ?>

and its working fine. The problem is when my input is not set type to 'select', the value will not display but set type to 'select', it is working then.

By the way, I am using Cakephp v2.4.6

Any help is much appreciated.

Thanks for ur support