Yii Framework Forum: Widget With Controller And Database Interaction - Yii Framework Forum

Jump to content

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

Widget With Controller And Database Interaction Rate Topic: -----

#1 User is offline   rtlm 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 02-February 14

Posted 24 June 2014 - 09:08 PM

Hi all,
I am thinking about creating a widget for some code I want to re-use, but am not sure if it is possible. I have a country/city selection function on my website which consists of 2 dropdown lists (country/city) and then an "Add" button which populates the selection into a container div. There is also some small javascript to handle removing selected entries and detecting duplicates. What I would like to do is move all of this functionality out into a widget, so it can be re-used on another page in my website. Given the fact that an Ajax request is used when the 'Country' is changed in order to populate the 'City' dropdown with results from a database query, is this going to be a difficult task, or maybe not even possible?
0

#2 User is offline   phtamas 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 529
  • Joined: 26-February 11
  • Location:Mezőtúr, Hungary

Posted 25 June 2014 - 06:57 AM

View Postrtlm, on 24 June 2014 - 09:08 PM, said:

Given the fact that an Ajax request is used when the 'Country' is changed in order to populate the 'City' dropdown with results from a database query, is this going to be a difficult task, or maybe not even possible?


You can create an Action class that responds to the AJAX request and works in conjunction with your widget.
1

#3 User is offline   rtlm 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 02-February 14

Posted 26 June 2014 - 09:51 PM

Thanks, looks like that will work for me
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