Yii Framework Forum: Merging Two Textfields And Preview It In Third Textfield Automatically When Keyup Trigers - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Merging Two Textfields And Preview It In Third Textfield Automatically When Keyup Trigers Rate Topic: -----

#1 User is offline   iqbalbaba 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 13-December 12

Posted 12 February 2013 - 04:40 AM

HI
BELOW is my code. when you type doc_name and Prefix and press tab key it should merge doc_name and Prefix textfields and display it in Preview field. Please help me.

<div class="row">
<?php echo $form->labelEx($model,'Doc_name'); ?>
<?php echo $form->textField($model,'Doc_name',array('size'=>50,'maxlength'=>50)); ?>
<?php echo $form->error($model,'Doc_name'); ?>
</div>

<div class="row"">
<?php echo $form->labelEx($model,'Prefix'); ?>
<?php echo $form->textField($model,'Prefix',array('size'=>10,'maxlength'=>10));?>
<?php echo $form->error($model,'Prefix'); ?>
</div>
<?php echo $form->labelEx($model,'Preview'); ?>

<?php echo $form->textField($model,'Preview',array('size'=>60,'maxlength'=>90)); ?>

<?php echo $form->error($model,'Preview'); ?>
</div>
0

#2 User is offline   kokomo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 289
  • Joined: 23-July 10

Posted 12 February 2013 - 05:13 AM

Welcome iqbalbaba,
I dont' have time to show you a complete example but I hope I can guide you into the right direction Posted Image

  • Add ID's to the three textfields => $htmlOptions
  • Define a keyup jQuery handler and use the defined ID's as selectors => jQuery Event - keyup or use jQuery's event bubbling
    • Inside the event handler:
      • get values from the doc_name and prefix textfield via val() function and ID selectors and/or use this
      • concatenate the values and set it also via val() function

This are the basic task you have to do. If you have problems you are welcome to ask specific questions here again.

This post has been edited by kokomo: 12 February 2013 - 07:01 AM

0

#3 User is offline   iqbalbaba 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 13-December 12

Posted 12 February 2013 - 05:24 AM

Hi Kokomo,

Thank you for your reply.


I am new to Yii and i started it 4 days before. Please guide me and if u know the coding please post me.

It will be helpful to me.

I appreciate your reply.
0

#4 User is offline   kokomo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 289
  • Joined: 23-July 10

Posted 12 February 2013 - 07:09 AM

View Postiqbalbaba, on 12 February 2013 - 05:24 AM, said:

I am new to Yii and i started it 4 days before. Please guide me and if u know the coding please post me.

The tasks to achieve your goal contains nothing special about yii knowledge. It's just javascript with help of jQuery.

If you have problems doing it I would strongly suggest you to look at some php/javascript/jQuery tutorials and learn the basics before you go further with yii.

Yii is a framework that assists you in doing tasks faster and in a more efficient way but can't help you if you miss basic coding knowledge.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users