Cascading dropdow showing all field values...

Status
Not open for further replies.

jo-ka

Member
Hello.

I have a situation where I need to have 2 country fields.

Country and Country of Birth. Essentially for players who born in one country and after some years will play for another national team.

In some 90% of the cases, Country and Country of Birth are the same, and I can use Cascading Drop Down to have the same value for both fields, having Country of Birth field watching Country field.

What i'm trying to achieve is to have the possibility to override the watched value on Country of Birth field, and select one of the other values from the country list.

Is this possible? With CCD element, or in a different way?

Thanks in advance.
 
You could use a join instead of a CDD, with a "WHERE" clause with AJAX update set to Yes. And use whatever placeholders you need in the where clause. With AJAX enabled, the element automatically "watches" whatever elements you use as placeholders in the WHERE clause, and updates your join options whenever one of the watched elements is changed.

-- hugh
 
You could use a join instead of a CDD, with a "WHERE" clause with AJAX update set to Yes. And use whatever placeholders you need in the where clause. With AJAX enabled, the element automatically "watches" whatever elements you use as placeholders in the WHERE clause, and updates your join options whenever one of the watched elements is changed.

-- hugh
Dear Cheesegrits, thanks for the suggestion, but I can't get this working, probably because I'm doing something wrong.

So I have a Country element on a Players list (fab_players___country), which is a Databasejoin to a Countries list. This is working ok.

So, for Country of Birth (fab_players___country_of_birth) your suggestions is to have another Databasejoin to the Countries list. This is OK. I can use and select the country here.

I've set the AJAX update to ON on (fab_players___country_of_birth) element. The problem is that I don't know how to build the Where filter on this element.

As I've explained before is, to automatically have the same country on both fields, but have the possibility to change the Country of Birth to another one.

BR
 
Well, what do you want to filter the country of birth to?

Maybe I'm misunderstanding what you are trying to do. Re-reading your original post, I think what you are wanting to achieve is that "Country of Birth" get set to "Country", but can then be changed.

In which case, the best bet is probably to use some custom JS on the Country element, so when it gets changed, it sets the COuntry of Birth element to be the same. But then the latter can be changed independently.

So keep them both as joins (no CDDs), ignore the WHERE clause, and put an 'onClick' JS event on you Country element that does:

Code:
this.form.formElements.get('yourtable___country_of_birth').update(this.getValue());

Change 'yourtable___country_of_birth' to your element's full name.

-- hugh
 
Thanks cheesegrits.

This is exactly what I was looking for.

Meanwhile I became interested on the AJAX filter for Databasejoin. Is there any way to understand better it's function?

Some wiki or blog post?

Thanks in advance
 
I think the tool tip about covers it. If you enable AJAX, any elements used as placeholders in the WHERE filter will be "watched" on the form, and when any of them are changed, the join element will be rebuilt, using the changed value(s).

Hugh

Sent from my HTC6545LVW using Tapatalk
 
I think the tool tip about covers it. If you enable AJAX, any elements used as placeholders in the WHERE filter will be "watched" on the form, and when any of them are changed, the join element will be rebuilt, using the changed value(s).

Hugh

Sent from my HTC6545LVW using Tapatalk
OK, I'll give it a try. Thanks.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top