Submit values only from visible elements.

  • Doboszj
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 0

Doboszj created the topic: Submit values only from visible elements.

Hello,

I have few Select Lists with visibility rules. Depends on what I choose on each one, the other lists will be visible.

When I will submit my form, values from all Lists will be saved. I would like to save only that values that are visible and the rest values set to null/empty.

How can I perform action like this?
#235020
  • mihaela
  • Away
  • Administrator
  • Administrator
  • Posts: 2360
  • Karma: 85
  • Thank you received: 316

mihaela replied the topic: Submit values only from visible elements.

Hello,

All field's values that are entered in the form, no matter whether the fields are visible or no, will be saved.

If you have defined your select list elements like this:
0;Title1;value1
0;Title2;value2
...
then first option which is in this case "value1" will always be selected on form load (even though the field may be hidden).

Therefore, the best way to avoid this kind of behavior is to define your select lists options as follow:
0;Choose option;
0;Title1;value1
0;Title2;value2
...
Therefore, on form load an empty value will be pre-selected and hidden elements won't be saved on submit.

Let me know whether you understand what I am trying to explain and whether you have managed to make this work for your form.

Regards,

Mihaela
#235021
  • Doboszj
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 0

Doboszj replied the topic: Submit values only from visible elements.

I tried to do exactly like this:
0;Choose option;

but there, I cannot set on my form rule like this:
if element test is off set test Choose option

because that rule hasn't got second parameter. When my list is invisible I would like to have every time set Choose option (without any value to safe when submitting).

Regards
Luck
#235025
  • mihaela
  • Away
  • Administrator
  • Administrator
  • Posts: 2360
  • Karma: 85
  • Thank you received: 316

mihaela replied the topic: Submit values only from visible elements.

Hello,

Ok, I understand. Here are few ways that this can be resolved.

First way is to rearrange your visibility rules like this if possible:
turn off element mytextfield if switcher isnot value3

If that isn't suitable for what you are doing, then you should resolve this using "JavaScript visibility rules".

Please take a look at this piece of documentation crosstec.org/en/support/online-documenta...s-in-javascript.html .

You can write Actionscripts to write visibility rules, or if that part works fine, but you just need to set select list to "Choose option", then you can write code similar to this:
function ff_field1_action(element, action) 
{
     if( ff_getElementByName('field1').value == "value1") {
               ff_getElementByName('field2').value = "";
          }
          
} // ff_test_action
This is an example of custom Actionscript code that will set the value of select list named "field2" to Choose option, or better said "", in case in select list "field1", "value1" is selected (which in this exampel is supposed to be the condition to turn off field2).

I hope that you understand what I am saying.
Let me know whether this helped and whether you have managed to set this for your form.

Regards,

Mihaela
#235030
  • Doboszj
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 0

Doboszj replied the topic: Submit values only from visible elements.

I think that I didn't well explain my scenario. I tried to explain in details in my_scenario file. Please take a look. I attached also my package.

Regards
Luck
#235034
Attachments:
  • Doboszj
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 0

Doboszj replied the topic: Submit values only from visible elements.

I think that I didn't well explain my scenario. I tried to explain in details in my_scenario file. Please take a look. I attached also my package.

Regards
Luck

File Attachment:

File Name: my_scenari...26-2.zip
File Size:11 KB
#235035
Attachments:
Moderators: ForumSupporttomeperica
Time to create page: 0.048 seconds

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans & templates!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here