value of one field depending on more select-fields

  • Posts: 5958
  • Karma: 119
  • Thank you received: 554

MarioPuco replied the topic: value of one field depending on more select-fields

Hey,

Sorry for the long wait. By your username I thought you will crack it :D
Either way here is the syntax that's working for this :

My Select-list :
0;Title 1;value1
0;Title 2;value2
0;Title 3;value3
This is my Select-list-Actionscript :
function ff_selekt_action(element, action)
{
    switch (action) {
        case 'change':

var val =JQuery('[name="ff_nm_selekt[]"]').val();  

if (val=="value1"){
ff_getElementByName("m1").value="Yes";
ff_getElementByName("m1").readOnly=false;
}
else if (val=="value2"){
ff_getElementByName("m1").value="Maybe";
ff_getElementByName("m1").readOnly=true;
}
else if (val=="value3"){
ff_getElementByName("m1").value="No";
}
            break;
        default:;
    } // switch
} // ff_selekt_action

And yes, usage of ff_getElementByName("bla").readOnly=true; is possible too :)

I'm sending you Form with this example embeded.

Regards,
Mario

Satisfied with our Support ?
PayPal Tip
===============================================
Need to renew Pro Support?
Buy Here!
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
#237414
Attachments:
  • Mister.Miracle
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 99
  • Karma: 1
  • Thank you received: 1

Mister.Miracle replied the topic: value of one field depending on more select-fields

Sorry, but it dont work :-(
function ff_select_action(element, action)
{
    switch (action) {
        case 'change':

			var val =JQuery('[name="ff_select_action[]"]').val();  

			if (val=="Auswahl 1"){
				ff_getElementByName("test").value="30";				
				ff_getElementByName("test").readOnly=true;
			}
			else if (val=="Auswahl 2"){
					ff_getElementByName("test").value="20";
					ff_getElementByName("test").readOnly=true;
				}
				else 
					if (val=="Auswahl 3"){
						ff_getElementByName("test").value="";
						ff_getElementByName("test").readOnly=false;
					}
            break;
        default:;
    } // switch
} // ff_select_action

I will select while using the form (frontend of Joomla) with "Auswahl 1" but nothing changed on field test :-(
You could imagine why? I dont :-(

Maybe it is possible to print-out test-messages on display to check where the problem is (debug-messages)?`

And... the usage ff_getElementByName("bla").hidden is possible also?
Thank you for your hint
#237425
  • Posts: 5958
  • Karma: 119
  • Thank you received: 554

MarioPuco replied the topic: value of one field depending on more select-fields

Hi,

Is Auswahl 1 the value of your Select list ? Cuz it seems like it's a label.
Select list is defined like this :
STATE;LABEL;VALUE
---------------
0;MARIO 1;mario1

Can you past your select-list List here please ?

Regards,
mario

Satisfied with our Support ?
PayPal Tip
===============================================
Need to renew Pro Support?
Buy Here!
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
#237431
  • Mister.Miracle
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 99
  • Karma: 1
  • Thank you received: 1

Mister.Miracle replied the topic: value of one field depending on more select-fields

0;keine Auswahl getroffen;keine Auswahl getroffen
0;Auswahl 1;Auswahl 1
But it is the same, if i create the select-list like this
0;keine Auswahl getroffen;keine Auswahl getroffen
0;Auswahl 1;Auswahl1
and use
(...) 
if (val=="Auswahl1"){
(...)

the result-field dont change :-(

i also created to test a code like this:
(...)
case 'change':
if (ff_getElementByName('ff_nm_SELECTLISTNAME').value == 'Auswahl 1')
			{
				ff_getElementByName('ff_nm_TARGETFIELDNAME').value = 'Testeintrag';
			}
			else 
			{
				ff_getElementByName('ff_m_TARGETFIELDNAME').value = 'Testeintrag 2';
			}
            break;
(...)

But this also dont work :-(

If this really will work fine... i need some case-definitions with if (field1) and if (field 2) and if (field 3) then target = result
so i need the combination of more than one select-list-elements (different select-elements).

But one first step i want to lets work fine with one field :-)

Thank you for helping
#237439
  • Posts: 5958
  • Karma: 119
  • Thank you received: 554

MarioPuco replied the topic: value of one field depending on more select-fields

Mr Miracle,

Select List
name : selekt
List :
0;keine Auswahl getroffen;keine Auswahl getroffen
0;Auswahl 1;Auswahl 1
0;OTHER;other



Textfield1
name : m1

Textfield2
name :m2

Can you try to make a new form and just embed this to get it working ? Maybe your form is depended on something else so that's why this is not populating ?
I'm going on my vacation and I won't be back before September so this could be my last post until then.

Regards,
Mario

Satisfied with our Support ?
PayPal Tip
===============================================
Need to renew Pro Support?
Buy Here!
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
#237440
Attachments:
  • Mister.Miracle
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 99
  • Karma: 1
  • Thank you received: 1

Mister.Miracle replied the topic: value of one field depending on more select-fields

Hi,
i generated a new form, but it dont work :-(

Screenshots are attached.
The Code of Selekt-Field is like this:
function ff_Selekt_action(element, action)
{
    switch (action) {
        case 'change':

			var val =JQuery('[name="ff_nm_selekt[]"]').val();  

			if (val=="Auswahl 1"){
				ff_getElementByName("test").value="30";				
				ff_getElementByName("test").readOnly=true;
			}
			else if (val=="other"){
					ff_getElementByName("test").value="20";
					ff_getElementByName("test").readOnly=true;
			}
				
            break;
        default:;
    } // switch
} // ff_Selekt_action

No Value 30 or 20 are displayed at field "test"... but why?
#237451
Attachments:
Moderators: ForumSupport
Time to create page: 0.106 seconds

We Are Doing Our Part

Massive discounts on all of our extension subscription plans to help you and your business in these times.

Get Your Subscription Here

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!

News and Updates

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

All Extensions Subscription

We are doing our part and support your business with extremely low prices -- For example 6-Months-Subscription for only $9 USD. For as long as necessary.

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!