Forums

conditionallay showin/hiding fields

kraadde 3d ago

I have  an Array "teiln_dat" with 0 to 2 Elements like "yyyy-mm-dd".

I want to show or hide a further field depending on the condition that "teiln_dat" has 2 Elements.

I tried with a php104 as an Event switcher:

if (isset($this->data['teiln_dat']) && is_array($this->data['teiln_dat']) && count($this->data['teiln_dat']) === 2) {    return 'yes';} else {    return 'no';} 

but seems not to work.Is there a better solution that works in the browser or likely a JSsript?

Max_admin 1d ago
Answer

You can use the PHP action with the Events behavior directly and place the other field in the "yes" event

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.

VPS & Email Hosting 20% discount
hostinger