TOPIC:

Automatic filling of a field according to the value selected in another field 4 months 3 days ago #262088

  • Johann09's Avatar Topic Author
  • Johann09
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 87
  • Thanks: 0
Hi,

I propose in my form a list of choices in the field "Field1":
the possible values are "value1", "value2", value3".
I would like the value of the field "Field2" to be automatically filled by a personal value according to the result of the selection of "Field1".

I tried the following code but it doesn't work:

function ff_Field2_action(element, action)
{
switch (action) {
case 'click':

if ff_getElementByName('Field1').value = 'value1' ff_getElementByName('Field2').value = 'custom_value1';
if ff_getElementByName('Field1').value = 'value2' ff_getElementByName('Field2').value = 'custom_value2';
if ff_getElementByName('Field1').value = 'value3' ff_getElementByName('Field2').value = 'custom_value3';

break;
default:;
} // switch
} // ff_Field2_action

Thank you for your help.

Please Log in or Create an account to join the conversation.

Automatic filling of a field according to the value selected in another field 4 months 2 days ago #262091

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 1373
  • Karma: 2
  • Thanks: 75
Hi,

could you please try like this :
GO->Action script and select type CUSTOM and Action 'Change' :
function ff_Field2_action(element, action)
{
switch (action) {
case 'change':
var field1 = ff_getElementByName('Field1').value;


if (field1 == 'value1'){

 ff_getElementByName('Field2').value = 'custom_value1';

}

if (field1 == 'value2'){

 ff_getElementByName('Field2').value = 'custom_value2';

}

if (field1 == 'value3'){

 ff_getElementByName('Field2').value = 'custom_value3';

}

break;
default:;
} // switch
} // ff_Field2_action

let me know the result!
Regards!

Please Log in or Create an account to join the conversation.

Last edit: Post by Mirec.

Automatic filling of a field according to the value selected in another field 4 months 2 days ago #262093

  • Johann09's Avatar Topic Author
  • Johann09
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 87
  • Thanks: 0
Thank you for your quick reply !

But it doesn't work, the field2 is empty...

here is my real code:
function ff_Start_Date_action(element, action)
{
switch (action) {
case 'change':
var Event_Name = ff_getElementByName('Event_Name').value;


if  = (Event_Name == 'Cycle 1 - Oct 8-15, 2021'){

 ff_getElementByName('Start_Date').value = 'Oct 8, 2021';

}

if  = (Event_Name == 'Cycle 1 - May 27 - Jun 3, 2022'){

 ff_getElementByName('Start_Date').value = 'May 27, 2022';

}

if  = (Event_Name == 'Cycle 1 - May 26 - Jun 2, 2023'){

 ff_getElementByName('Start_Date').value = 'May 26, 2023';

}

break;
default:;
} // switch
} // ff_Start_Date_action

Thank you for your help.

Please Log in or Create an account to join the conversation.

Automatic filling of a field according to the value selected in another field 4 months 2 days ago #262094

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 1373
  • Karma: 2
  • Thanks: 75
Hi,

can you please send us your form so we can test it. Follow this steps to create a Form Pacakge:

crosstec.org/en/support/online-documenta...ted/94-packages.html

Regards,
Mirko

Please Log in or Create an account to join the conversation.

Last edit: Post by Mirec.

Automatic filling of a field according to the value selected in another field 4 months 2 days ago #262096

  • Johann09's Avatar Topic Author
  • Johann09
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 87
  • Thanks: 0
Please, see the attached field. This is an extract from my form
Start_Date field is in "Your Choice" Section

Thank you very much !
Attachments:

Please Log in or Create an account to join the conversation.

Automatic filling of a field according to the value selected in another field 4 months 2 days ago #262098

  • Mirec's Avatar
  • Mirec
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 1373
  • Karma: 2
  • Thanks: 75
Hi,

I solved it and work on my server!

in field Event_name in Action script select type custom and Action Change and insert this code:
function ff_Event_Name_action(element, action)
{
    switch (action) {
        case 'change':

 if (element.value =="Cycle 1 - Oct 8-15, 2021"){

 ff_getElementByName('Start_Date').value = "Oct 8, 2021";

}

if (element.value == 'Cycle 1 - May 27 - Jun 3, 2022'){

 ff_getElementByName('Start_Date').value = 'May 27, 2022';

}

if (element.value == 'Cycle 1 - May 26 - Jun 2, 2023'){

 ff_getElementByName('Start_Date').value = 'May 26, 2023';

}

            break;
        default:;
    } // switch
} // ff_Event_Name_action

Please download->unzip->and install it (BF->Configuration->Package Installer->select this xml file->Install Package).

Let me know the result!
Regards,
Mirko
Attachments:
The following user(s) said Thank You: Johann09

Please Log in or Create an account to join the conversation.

Last edit: Post by Mirec.
  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.051 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

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!