Yii Framework Forum: Populating a dropdown box based on text field data - Yii Framework Forum

Jump to content

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

Populating a dropdown box based on text field data Rate Topic: -----

#1 User is offline   Yasir Liaqat 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 14-June 11

Posted 22 April 2012 - 02:24 PM

Hi,

I am trying to populate a dropdown list based on the text provided in the text field. I wish to populate Address Line 1 based on the post code provided. Data has to come from a function with various different values. A dropdown and two text fields will get populated with data returned.

How do we achieve this? please help.

Regards
Yii - Yes it is
Simply a best php framework on earth

Cheap Business Cards Printing | Cheap Flyers Printing | Cheap Posters Printing | Cheap Website Design
0

#2 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,180
  • Joined: 05-January 12
  • Location:Morocco

Posted 22 April 2012 - 02:34 PM

Hello Yasir. Is your function on the client side or the server side? How do you call it?
0

#3 User is offline   Yasir Liaqat 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 14-June 11

Posted 22 April 2012 - 02:48 PM

View Postbennouna, on 22 April 2012 - 02:34 PM, said:

Hello Yasir. Is your function on the client side or the server side? How do you call it?



I have a form with text field post code. Once a text is entered in the field, a button on front of the field will be clicked to populate following fields:

1. a drop down field with all the door numbers
2. a text field for town will be filled
3. a text field for city will be filled

all this data has to come from a php functions will will return 3 variables?

variable 1 will be an array of door numbers
variable 2 will be a normal variable containing town name
variable 3 will be a normail variable containing city name

the function which will be returning these variables will first receive post code as explained above and based on that post code the required information will get populated. An XML web service will be returning that data and I intend to get that XML data converted in to above variables.
Yii - Yes it is
Simply a best php framework on earth

Cheap Business Cards Printing | Cheap Flyers Printing | Cheap Posters Printing | Cheap Website Design
0

#4 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,180
  • Joined: 05-January 12
  • Location:Morocco

Posted 22 April 2012 - 04:21 PM

Ok, so I guess when you click that button, there's some controller action using the post code field value, fired through ajax to retrieve the variables.

It's easy to parse XML by PHP, so I suggest you'd parse your returned values in PHP, and return JSON values that you'll display into your input fields on success of the ajax call.
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