Welcome Guest, Not a member yet? Register   Sign In
RE-populating Dynamic Drop-downs
#1

[eluser]Jon Parker[/eluser]
Hi Guys... I've been pulling my hair out with this for too long now.

I'm using CI and jQuery (although I know almost nothing about jQuery)

Here's the problem... It's more of a theoretical one

I'm using a jQuery plugin that populates 4 chained select boxes via AJAJ

I have Country, Region, SubRegion and Town, which are used to determine the location of a property.

As it's a relational database, so only the TownId is stored for each profile.

When you select a county, the region box is populated with the corresponding regions and when you select a region, the SubRegion box is populated with the corresponding sub-regions etc etc etc etc

Now, this all works fine when adding a new record but I just can't get my head round how I should be handling situations where a submitted form is shown again (e.g when validation of another form field fails) or when I'm updating a record that already exists.

As the data in the select boxes is hierarchical, how do I go about RE-populating the boxes with the corresponding values??

The only way I can think of doing this so far is way over my head with jQuery and I was wondering if anyone else could give me a point in the right direction?

The only way I can think of doing it at the moment is by replacing the select boxes with text and a hidden form field when that data has been submitted correctly.

Then if they wanted to edit the location, they could click an 'Edit Location' link, which would replace the text and hidden field in the form with the original select boxes via jQuery.

This just seems a bit of a messy way of doing things but I can't seem to find another example on the web to replicate, nor anyone with similar problems.

Any help would be REALLY appreciated

Cheers

Jon


Messages In This Thread
RE-populating Dynamic Drop-downs - by El Forum - 09-17-2008, 12:37 AM
RE-populating Dynamic Drop-downs - by El Forum - 09-17-2008, 01:09 AM
RE-populating Dynamic Drop-downs - by El Forum - 09-17-2008, 01:24 AM
RE-populating Dynamic Drop-downs - by El Forum - 09-17-2008, 01:40 AM
RE-populating Dynamic Drop-downs - by El Forum - 09-17-2008, 02:37 AM
RE-populating Dynamic Drop-downs - by El Forum - 09-17-2008, 05:36 AM
RE-populating Dynamic Drop-downs - by El Forum - 09-17-2008, 07:36 AM
RE-populating Dynamic Drop-downs - by El Forum - 09-17-2008, 07:43 AM
RE-populating Dynamic Drop-downs - by El Forum - 09-17-2008, 08:31 AM
RE-populating Dynamic Drop-downs - by El Forum - 09-17-2008, 09:33 PM
RE-populating Dynamic Drop-downs - by El Forum - 09-17-2008, 10:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB