Yii Framework Forum: How To Add A Dropdownlist To Append Tag In Jquery - Yii Framework Forum

Jump to content

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

How To Add A Dropdownlist To Append Tag In Jquery Rate Topic: -----

#1 User is offline   SUBHASH 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 08-November 12

Posted 04 December 2012 - 05:56 AM

Here i am enable to add the dropdownlist to append tag of jquery can any one help me in this
here is my code

$(document).ready(function(){

$(".tasks-add").click(function () {
$('.tasks').append('<li class="elements"><?php echo $form->labelEx($modelAcademics, 'Academic'); ?><?php echo $form->dropDownList($modelAcademics, '[]academics', array('school', 'college'));?></li>');

});

});


but i am able to add the textfield instead of dropdownlist can any help me in this
0

#2 User is offline   iIrfan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 25-April 14

Posted 02 May 2014 - 05:19 AM

View PostSUBHASH, on 04 December 2012 - 05:56 AM, said:

Here i am enable to add the dropdownlist to append tag of jquery can any one help me in this
here is my code

$(document).ready(function(){

$(".tasks-add").click(function () {
$('.tasks').append('<li class="elements"><?php echo $form->labelEx($modelAcademics, 'Academic'); ?><?php echo $form->dropDownList($modelAcademics, '[]academics', array('school', 'college'));?></li>');

});

});


but i am able to add the textfield instead of dropdownlist can any help me in this


im also trying for same.. if got solution let me know plzzz
0

#3 User is offline   Absar A Hasan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 39
  • Joined: 23-November 13
  • Location:Pune, India

Posted 02 May 2014 - 06:25 AM

You can not use php code inside JavaScript for appending in html, you can use ajax to get created dropdown html from php file
0

#4 User is offline   langy 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 27-November 13

Posted 04 May 2014 - 03:03 AM

As pointed out by Absar a PHP code cannot get executed from a client via javascript at runtime. You would need to trigger a call back to server using Ajax (where you can run any PHP code) and send back a response to client to overwrite your html markup.
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