Function Javascript show/hide VERY IMPORTANT

rubensantos 23 Oct, 2014
good Morning
I would like to get help for a javascript function of type "array".
My problem is the following:

I have a Dropdown with "Number of Floors" ranging from 1-64
Obviously I have 64 inputboxes, like all inputboxes showed that depending on the number selected in the dropdown.
When I try to add validations that are a total of (64 options in the dropdown) x (64 inputboxes) gives a total of 4160 validations.

I would like to resolve the matter with an "array" in javascript, can anyone help me?

Sorry for my bad English.

Already a thank,
Reuben Santos
Max_admin 23 Oct, 2014
Hi Reuben,

What are you trying to validate exactly ? or how do you want to run the validation ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rubensantos 23 Oct, 2014
As follows:
Dropdown has 64 options
Number of floors: 64 numbered options
If you choose 1 presents inputbox1
if you choose 2 presents inputbox1 and inputbox2
If esconlha 64 presents inputbox1, inputbox2 (...) inputbox64

I think the problem can be solved with javascript
GreyHead 23 Oct, 2014
Hi Reuben,

I'm not clear why you need one input box for each drop-down option - isn't one enough for all of them.

And I'm even less clear how you end up with 4160 validations - I make it 128.

But perhaps I don't understand what you are trying to do.

And what validation do you need? I would probably do this using PHP in a Custom element element.

Bob
rubensantos 23 Oct, 2014
I have a Dropdown with "Number of Floors" that goes from number 1 to number 64, the idea is for example:

(Dropdown)
Number of floors: 32

Becomes visible inputbox1, inputbox2, inputbox3 (...) inputbox32

Basically inputboxes become visible depending on the number selected in the dropdown

Ruben Santos
Max_admin 23 Oct, 2014
You can do this in an easy way:

a 2 pages form, first page you get the number of floors, 2nd page you generate the dropdowns using PHP in a custom element, all of them can have the class "validate['required']", that should do what you need quickly and with least effort.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Max_admin 23 Oct, 2014
You can check the multi page demo form for how to build a multi page form, its included in the installer!

Then, here is a sample code on how to generate a list of fields using PHP, the code below should go into an element of type custom, with pure code enabled, and with the editor disabled:


<?php
if($form->data("floors_dropdown_name")){
for($i = 0; $i < $form->data("floors_dropdown_name"); $i++){
echo \GCore\Helpers\Html::formLine('floor_'.$i, array('type' => 'text', 'label' => "Floor #".$i));
}
}
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rubensantos 23 Oct, 2014
I need to present all on the same page, because most fields have to be introduced further down and I choose only one option in dropdwon "Number of Floors" everything else are just textboxes that will be presented depending on the number selected in the dropdown "Number floors "
Max_admin 26 Oct, 2014
Hi Ruben,

The next update has something which can help you in this situation, the dropdown has a new event called "load dynamic html", which can load extra form elements using AJAX and insert them inside a container in your form, and so you can use my code above inside a "custom code" action in a new event and point the dropdown to that event to load the fields on the same page.

The new update is expected this week!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rubensantos 27 Oct, 2014
Thank you, For Help , So What an update is released that will could help me solve my problem ?🙂

Thank you so much🙂

greetings
Ruben Santos
Max_admin 27 Oct, 2014
It will have an extra feature which may help.

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.