Submit values only from visible elements.

  • Posts: 2109
  • Karma: 72
  • Thank you received: 268

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

Hello,

Here is how to make this work as you wanted.

Please go to Advanced properties of the "lokalizacja" element. In the Actionscript section set Type to Custom and Action to Change.

In the code area below put the following code:
function ff_lokalizacja_action(element, action)
{
   if( ff_getElementByName("lokalizacja").value == "Warszawa" ){
    		ff_getElementByName("zakres_gdansk").value = "";
    		ff_getElementByName("grupy_gdansk_I").value = "";
    	}

     if( ff_getElementByName("lokalizacja").value == "Gdańsk" ){
    		ff_getElementByName("zakres_warszawa").value = "";
    		ff_getElementByName("grupy_warszawa_I").value = "";
    	}
} // ff_lokalizacja_action

I'm sending you a form with that change applied.

Let me know whether this works as you wanted.

Regards,

Mihaela
#235063
Attachments:
The following user(s) said Thank You: Doboszj
  • Doboszj
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 0

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

That was my point. Only selected values will submit.

My second question was about how to apply below conditions because now they are not working.

turn off section sekcja_grupy_warszawa_I if zakres_warszawa isnot Choose option
turn on section sekcja_grupy_warszawa_I if zakres_warszawa is Choose option

Regards
Luck
#235104
  • Posts: 2109
  • Karma: 72
  • Thank you received: 268

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

Hello again,

Ok, so the empty values problem is solved.

The two visibility rules that you have listed can only function if you define them using JavaScript as explained in this article crosstec.org/en/support/online-documenta...s-in-javascript.html .

In your case Actionscript code for the zakres_warszawa filed would look like:
function ff_zakres_warszawa_action(element, action)
{  
  if( ff_getElementByName("zakres_warszawa").value == "" ) {
    bfToggleFields('on','section','sekcja_grupy_warszawa_I',bfDeactivateField); }
  else {
    bfToggleFields('on','section','sekcja_grupy_warszawa_I',bfDeactivateField); }

} // ff_zakres_warszawa_action

NOTE: From this visibility rule:
turn off section sekcja_grupy_warszawa_I if zakres_warszawa isnot Choose option
It turns out that you want to display "sekcja_grupy_warszawa_I" ONLY in case zakres_warszawa is set to "Choose option" while in your form I see you have tris rule as well:
turn off section sekcja_grupy_warszawa_I if zakres_warszawa isnot I stopnia
turn on section sekcja_grupy_warszawa_I if zakres_warszawa is I stopnia

In case you want the section to show also when zakres_warszawa is "I stopnia" then the code must look like this:
function ff_zakres_warszawa_action(element, action)
{  
  if( ff_getElementByName("zakres_warszawa").value == "" || ff_getElementByName("zakres_warszawa").value == "I stopnia" ) {
    bfToggleFields('on','section','sekcja_grupy_warszawa_I',bfDeactivateField); }
  else {
    bfToggleFields('on','section','sekcja_grupy_warszawa_I',bfDeactivateField); }

} // ff_zakres_warszawa_action

Standard visibility rules regarding this must be deleted so that JavaScript visibility rules would work.

Let me know whether you have managed to set this for your form.

Regards,

Mihaela
#235147
  • 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 visibility rules in script but something is still missing. It is almost like in my scenario. It's hard to expalin so I sent attachement with screens describing how it would work

Regards
Luck

File Attachment:

File Name: my_scenari...3-29.zip
File Size:58 KB
#235159
Attachments:
  • Posts: 2109
  • Karma: 72
  • Thank you received: 268

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

Hello,

I have put the following code in the Initialization script in Advanced properties > More options of your form:
function ff_Select_List_null_value_init()
{
setInterval(showorhide, 500)
} // ff_Select_List_null_value_init

function showorhide() {
if( ff_getElementByName("zakres_warszawa").value == "I stopnia" ) {
    bfToggleFields('on','section','sekcja_grupy_warszawa_I',bfDeactivateField); }
  else {
    bfToggleFields('off','section','sekcja_grupy_warszawa_I',bfDeactivateField); }

if( ff_getElementByName("zakres_gdansk").value == "I stopnia" ) {
    bfToggleFields('on','section','sekcja_grupy_gdansk_I',bfDeactivateField); }
  else {
    bfToggleFields('off','section','sekcja_grupy_gdansk_I',bfDeactivateField); }
}

Also, I have removed some unnecessary visibility rules.

I'm sending you a package with the explained chnages in the form.

File Attachment:

File Name: select_lis...ted1.zip
File Size:11 KB


Let me know whether your form now works as you wanted.

Regards,

Mihaela
#235186
Attachments:
The following user(s) said Thank You: Doboszj
  • Doboszj
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 0

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

This is it! Thank You very much.

Regards
Luck
#235187
Moderators: ForumSupporttomeperica
Time to create page: 0.046 seconds

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

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€

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!

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