Selectlist with validation and in off-state still produces invalid message.

  • hoekbrwr
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 79
  • Thank you received: 3

hoekbrwr replied the topic: Selectlist with validation and in off-state still produces invalid message.

function ff_chkb_sec_action(element, action)
{
	switch (action) {
	case 'change':
		if (element.checked == true) {
			bfToggleFields('on', 'section', 'sec_select', bfDeactivateField);
			bfToggleFields('on', 'element', 'selectlist', bfDeactivateField);
			bfToggleFields('off', 'element', 'selectlist', bfDeactivateField);
		} else {
			bfToggleFields('off', 'section', 'sec_select', bfDeactivateField);
		}
	        break;
	default: ;
	} // switch
} // ff_chkb_sec_action
This is my solution for this form. However, I did not find the right place (yet) in my original form to accomplish the same. There is definitely something uncomplete during the initialisation of the select list.
#236935
  • Posts: 2428
  • Karma: 85
  • Thank you received: 330

mihaela replied the topic: Selectlist with validation and in off-state still produces invalid message.

Hello,

I think I know what might be causing this kind of behavior.

It seems that when the section "sec_select" is first activated because the "chkb_sec" is checked, it is not recognized that a "selectlist" element in that section is still hidden even though the whole section is turned on.

Therefore, it can be resolved by adding a condition in "chkb_sec" element's Actionscript.

This is the final code for the section:
unction ff_chkb_sec_action(element, action)
{
	switch (action) {
	case 'change':
		if (element.checked == true) {
			bfToggleFields('on', 'section', 'sec_select', bfDeactivateField);
                        if( ff_getElementByName('chkb_selectit').checked == false ) {
                            bfToggleFields('off', 'element', 'selectlist', bfDeactivateField);
			    ff_getElementByName('selectlist').options[0].selected = true;
                         }
		} else {
			bfToggleFields('off', 'section', 'sec_select', bfDeactivateField);
		}
	        break;
	default: ;
	} // switch
} // ff_chkb_sec_action

This part is added:
if( ff_getElementByName('chkb_selectit').checked == false ) {
                            bfToggleFields('off', 'element', 'selectlist', bfDeactivateField);
			    ff_getElementByName('selectlist').options[0].selected = true;
                         }

Let me know whether this resolves the problem.

Regards,

Mihaela
#236960
  • hoekbrwr
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 79
  • Thank you received: 3

hoekbrwr replied the topic: Selectlist with validation and in off-state still produces invalid message.

Now I had some time to try your suggestion.
I have defined the fields with a status of not Turn Off, so don't check that box for checkbox and select field(in principle for every field).
In the initiation phase of the form I switch this section on and then off and the fault balloon does not appear anymore when the element is not active. The validation has been initialized then.
Long ago I tried a special validation script and have put it into my library where I validate only when the element is active. I have no time to look into that now, but I don't know exactly how to check is an element is active.
#236966
  • Posts: 2428
  • Karma: 85
  • Thank you received: 330

mihaela replied the topic: Selectlist with validation and in off-state still produces invalid message.

Hello again,

I am not sure if now it is working as you wanted, or there is still an issue present?
I've tested the form on the link ndo-dev.leovanderhoek.nl/index.php/2014-...-59/select-list-test and it seems to be working fine now.

Let me know whether the issue is resolved.

Regards,

Mihaela
#236976
  • hoekbrwr
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 79
  • Thank you received: 3

hoekbrwr replied the topic: Selectlist with validation and in off-state still produces invalid message.

The link you tried has been set up now that it does not produce ghost fault messages due to my special setting rules.
This is still a tricky situation when you define a select list in a section that will be switched on and off.
I have now memorized to define the select list without checking the Turn Off property and at least switch the parent section on-off during the initialization phase.
I know now how to handle that and I hope other people will find this blog item and understand what is happening.
Better is considering a project to find out an improved form initialization of required fields and prevent ghost fault messages! There could be other fields that will show the same behavior?
#236977
Moderators: ForumSupporttomeperica
Time to create page: 0.065 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

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 and icon packs!

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