Forums

show/hide HTML fields based on the content of dinamyclly-filled hidden fields?

yorai85 24 Oct, 2017
hello there,

i have a blog website with about 10 authors, and i'm creating a contact form to be placed on the bottom of each blog item, near the "about the author" box. that form will be used to contact the author of the currently-viewed article.

i want to use 1 form for all the authors - and set some values based on to HTML elements in the page: the author's name & the author's email.
so i've created some hidden fields and custom JS to catch these values - and i'm using them in the email actions - to decide where to send the email and which name to use.

but - i also want to change the form's title & intro-text based on that information. so that the form will display different title & intro-text based on the author of the currently-viewed article.

i was thinking to create some custom HTML element, 1 for each author, and then hide/show them based on the content of the hidden field with the author's name. but the hidden fields in CF does not have any options for setting events.
the solution to this seemes to be using regular fields instead of hidden fields, and hidding them "manualy". but i wanted to ask if there is maybe a better way which i am not considering?

thank you very much
yorai
Max_admin 24 Oct, 2017
Hi Yorai,

Do not use HTML fields, just get the article id and load the info using a "Read data" action then use the data to send the email to the correct author.

Best regards
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
yorai85 24 Oct, 2017
thank you max, i don't know the "read data" action, will check it out.

but as far as i understand you that would apply only to the emails - is there a way to change the show/hide custom HTML areas in the form, based on the content of that information?

for example if the author's name is "Bill Gates", then a specific HTML area with information about Bill Gates will be displayed.
but if the author name is "Steve Jobs" then a different HTML arae will be displayed, with information about Seteve Jobs, and the area with information about Bill Gates will be hidden.

in the form i will create a different HTML area for each author (containing it's information), and i want to display only the arae about the current author, while the others are kept hidden.

yorai
Max_admin 28 Oct, 2017
Hi Yorai,

Yes you can do that, did you check the "dynamic dropdown" demo form for how to reload a dropdown ? you just do the same but instead you load a "segment area", and add your custom HTML code inside that segment.

The different content of course can be loaded from a database or some other way, based on your implementation.

Best regards
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
yorai85 29 Oct, 2017
1 Likes
Thank you max, i will do that.
yorai
This topic is locked and no more replies can be posted.