Forums

Text field populated with Dropdown Label

giacall 07 Jun, 2017
I Feel so stupid.. But i'm not able to figure out.
Wich is the correct way to populate a fieldtext with the label (not the key) of a dropdown field?

E.G.
Dropdown options:

1=Yes
2=No


I would like to set the field text value = to YES or NO depending the dropdown selection...

I tryed to reload the field text and call an event with a switch and a custom code, but with no lucky.
Thank's in advance..
LUCA
giacall 07 Jun, 2017
HI Bob

Thank's for replay.
But the FAQ is for CF4. I'm working in CF6.
It's the same ?

Luca
GreyHead 07 Jun, 2017
Hi Luca,

Yes, I think so.

Bob
giacall 07 Jun, 2017
Ok.
Tomorrow i try and i'll give you a feedback

Luca
giacall 08 Jun, 2017
No.. It does not work..
Or .. better.. I'm not able to apply the CF4 FAQ'S to CF6..
I also read this FAQ on how to use the Variable ShortCode.

I also triyng this way:
In the DROP_DOWN i set an EVENT on CHANGE to RELOAD the text field.
In the TEXT_FIELD i set the reload option with UPDATE event.
I created an event called UPDATE.
Put inside a switch to convert the DROP_DOWN:KEY in the DROP_DOWN:VALUE
A custom code to reload the TEXT_FIELD
{view:text_field_name}

Put in the TEXT_FIELD value option the
{var:name_of_the_switch}


But nothing..
Hoping in your help.
Regards
Luca
Max_admin 08 Jun, 2017
Hi Luca,

When the dropdown value is changed, its value is passed to the reload event, so in the text field "Label" box you can use this:

{data:dropdown_field_name}


This will bring you the value of the selected option, but if you want the text then you need a "Switch" function (not event switcher), use it before the "custom code", set the data provider to the shortcode above, and set the values to the same dropdown options, but you will have to replace the "=" with ":"

Now use this in the "Label" field of the text field:
{var:name_of_the_switch}


Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
giacall 09 Jun, 2017
Hi Max. Thank's for replay.
Your hint work, but set the label of the text field... Not the value.

My dropdown options is:

1=RED
2=WHITE
3=BLACK


The switch (not switch event) is:

1:RED
2:WHITE
3:BLACK


I would like to set the value of the text field with RED or WHITE or BLACK depending the dropdown choice.
Well... Where i must put the code {var:switch_name} in the text_field options to set the value with the color?

Thank's in advance
Luca
Max_admin 09 Jun, 2017
Hi Luca,

You should place it in the "Value" setting then!🙂

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
giacall 09 Jun, 2017
HI Max..
I suppose this is the right way.. and I try several time..

But it does not work.
Putting the {var:name_of_the_switch} in the field_text value options does not set the value.
The text field remain empty
GreyHead 09 Jun, 2017
Hi Luca,

Please check the FAQ I linked to earlier in this thread.

Bob
Max_admin 10 Jun, 2017
Hi Luca,

So the {var:} shortcode does not work in the "Value" but works in the "Label" ?

I could not test this, but it may be because of the posted form data to the reload event, please try to add this code in the "Extra attributes" box of the "Text field":
data-ghost:1


Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.