Show/hide area events between sections in Chronoforms V6?

Max_admin 15 Apr, 2017
Hi havex,

How exactly ? what are you trying to do ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
havex 15 Apr, 2017
Hi Max,

Let's say I have the following structure in a multi page setup.

Section 1 (Page 1)

Radio group: yes/no

....

Section 2 (Page 2)

Field2
....

I would like to show/hide Field2 in Section 2 according to radio selection made in Section 1.

Thanks
Max_admin 16 Apr, 2017
Hi havex,

So section 2 will appear in a different page, after page 1 has already been submitted ?

How are you building a multi page form in v6 ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
havex 16 Apr, 2017
Hi Max,

So section 2 will appear in a different page, after page 1 has already been submitted ?



Yes. I'm using section 1 in page 1 and section 2 in page 2 which will appear after section 1 is submitted.

How are you building a multi page form in v6 ?



There are no pages in CV6 so I am using different sections as different pages.
I am building the pages as follow:

In Designer sections, I have:

Section 1, section 2

In the Events I have the following events:

Load
Display_section - display_section1
(This is page 1 which will submit to Page2 event (display_section2)


Submit

Debugger


Page2

Display_section - display_section2

(This display Section 2 in page 2)

Thanks
Max_admin 16 Apr, 2017
Hi havex,

Nice, the new release should introduce a new Multi Page action to store the form data between pages easily.

Back to your main question, you want the field in section 2 to be shown/hidden or existing/not existing ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
havex 16 Apr, 2017

Nice, the new release should introduce a new Multi Page action to store the form data between pages easily.


Great, the CV6 is getting better and better!

Back to your main question, you want the field in section 2 to be shown/hidden or existing/not existing ?



"existing/not existing" is what I like more; but "shown/hidden" is also an option.

Also, I started building this long form (questionnaire) while learning CV5. But soon later CV6 was released, so I tried it.

There are a lot of options in CV5 that are not available in CV6 and also there is CV5 documentation and a lot of forum posts that cover a lot of issues and solution. But CV6 is a lot faster and I'm loving it.

In terms of UI, I would love the possibility to expand/collapse, move, delete and sections; Section name editing; copy and past of areas in sections in the Designer - Sections.

But I think that this is only temporary, as Chronoforms V6 is a great form builder, maybe the best I have used in 10 years, and it will have everything cv5 has and a lot more.

Thanks Max for this great form builder.
Max_admin 17 Apr, 2017
Hi havex,

Great, I'm glad you like v6🙂

You can control a field existing using a bit of PHP, here is how, create a new section, place your conditional field inside, then take a note of the field's "view" name, its inside a "black label", now place an HTML element (under custom) where this field may exist, and use this code inside:
<?php
if($this->data["radio"]){
  echo $this->Parser->parse("{view:field_view_name}", true, true);
}

But I will try to make this easier in the next update.

The new release (expected later today or tomorrow) has a new partitions area which you can use to have a questionnaire form, it will work like a survey and you can show/hide the field since the page does not change when going through the form.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
havex 17 Apr, 2017
1 Likes
Hi Max,

Thanks. I tried the code above but it gave me some error. Anyway, I am not sure what it does.
But it gave me an idea and I did the following:

Section 1

Radio group: do you have A? (yes/no) (Radio group id here is radio)

Section 2

Question 1 (if answer in section 1 is Yes) ( id: question-1)
Question 2 (if answer in section 1 is No) (id: question-2)

no=No
yes=Yes

In order to hide question 1 if answer in section 1 is yes; I added the following code in the beginning of section 2:

<?php
$display = 'none';
if ( $this->data['radio'] == 'no' ) {
$display = 'block';
}

$style = "
#question-1 {
display: {$display} !important;
}
";
$jdoc = JFactory::getDocument();
$jdoc->addStyleDeclaration($style);
?>



This seems to work without problems.

I can't wait for the new update🙂

Thanks
This topic is locked and no more replies can be posted.