Yii Framework Forum: Form - Add An Item Into Array - Yii Framework Forum

Jump to content

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

Form - Add An Item Into Array Rate Topic: -----

#1 User is offline   andforto 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 11-June 14

Posted 26 June 2014 - 12:12 PM

I have a very simple project with one model which has one element is an array. The array will be a checkboxlist In update page.. When user click on a link, javascript opens a prompt for user_input then add the input into the array and display. The part I could not figure out is how can i get the value return from the javascrip. Can someone please help? Thanks.
0

#2 User is offline   noorkhan885 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 14-June 14
  • Location:Ismabad, Pakistan

Posted 26 June 2014 - 01:19 PM

can you please share the related code of model and update?
0

#3 User is offline   andforto 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 11-June 14

Posted 26 June 2014 - 01:40 PM

View Postnoorkhan885, on 26 June 2014 - 01:19 PM, said:

can you please share the related code of model and update?


I cant figure out how to add/append an item to the items without submitting the form...

the button in form,
<?php echo $form->labelEx($model,'items'); ?>
<?php echo CHtml::button("add",array('title'=>"item",'onclick'=>'javascript:addItem()'); ?>

js:
function addItem() {
return 'aaaa';
}

I tried:
<?php echo CHtml::button("add",array('title'=>"item",'onclick'=>'aaa = javascript:addItem()'); ?>
<?php echo $aaa; ?>
doesnt work, of course... :(
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