TOPIC:

Copy Fields Values (Concatenate) to another field based on a list value 3 weeks 3 days ago #261021

  • Topic Author
  • papin0
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 143
  • Thanks: 0
I have these fields

Textfields:
[firstname] [middlename] [lastname] //to Copy from

Select from list
[relationship1] //value to use is "SELF"

To Copy and Concatenate to Textfield
[subscriber]

this what I have so far
function ff_relationship1_action(element, action)
{
    switch (action) {
        case 'change':
{
if ff_getElementByName('relationship1').value = "SELF"
 
ff_getElementByName('subscriber').value = ff_getElementByName('firstname').value;
            break;
        default:;
    } // switch
} // ff_relationship1_action

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

Copy Fields Values (Concatenate) to another field based on a list value 3 weeks 3 days ago #261029

  • Mirec's Avatar
  • Mirec
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 454
  • Karma: 2
  • Thanks: 19
Hi,

if I understand you well and what I can see in your provided code, it should be like this:

Go on element 'relationship1' ->Advenced -> Scrolldown to the ActionScript and select type 'Costum' and Action 'Change' and input code bellow:
function ff_relationship1_action(element, action)
{
    switch (action) {
        case 'change':
var firstname =ff_getElementByName('firstname').value;
if (element.value == "SELF"){
 
ff_getElementByName('subscriber').value = firstname;

}
            break;
        default:;
    } // switch
} // ff_relationship1_action

I hope it is what you ask if not, you can a little better describe it and I'll help you.

It's to late and we will continue tomorrow.

Regards,
Mirko

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

Last edit: Post by Mirec.

Copy Fields Values (Concatenate) to another field based on a list value 3 weeks 2 days ago #261032

  • Topic Author
  • papin0
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 143
  • Thanks: 0
Is working perfect:
function ff_relationship2_action(element, action)
{
    switch (action) {
        case 'change':
var firstname = ff_getElementByName('firstname').value;
var middlename = ff_getElementByName('middlename').value;
var lastname = ff_getElementByName('lastname').value;

if (element.value == "SELF"){
 
ff_getElementByName('subscriber2').value = (firstname) + (" ") + (middlename) + (" ") + (lastname);

}
            break;
        default:;
    } // switch
} // ff_relationship2_action

But I need to be able to clear the value of subscriber2 if element value isnot "SELF"

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

Copy Fields Values (Concatenate) to another field based on a list value 3 weeks 2 days ago #261036

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 6455
  • Karma: 3
  • Thanks: 456
Hi,

please test it like this:
 function ff_relationship2_action(element, action)
{
    switch (action) {
        case 'change':
var firstname = ff_getElementByName('firstname').value;
var middlename = ff_getElementByName('middlename').value;
var lastname = ff_getElementByName('lastname').value;

if (element.value == "SELF"){
 
ff_getElementByName('subscriber2').value = (firstname) + (" ") + (middlename) + (" ") + (lastname);

}
else if (element.value != "SELF") {
ff_getElementByName('subscriber2').value="";
}
            break;
        default:;
    } // switch
} // ff_relationship2_action

Regards,
Tihana

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

Copy Fields Values (Concatenate) to another field based on a list value 3 weeks 2 days ago #261046

  • Topic Author
  • papin0
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 143
  • Thanks: 0
it worked great.

How can I make subscriber2 Read-Only is value is "SELF"

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

Copy Fields Values (Concatenate) to another field based on a list value 3 weeks 2 days ago #261048

  • Topic Author
  • papin0
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 143
  • Thanks: 0
No worries, I got it and working perfect
 function ff_relationship1_action(element, action)
{
    switch (action) {
        case 'change':
var firstname = ff_getElementByName('firstname').value;
var middlename = ff_getElementByName('middlename').value;
var lastname = ff_getElementByName('lastname').value;

if (element.value == "SELF"){
 
ff_getElementByName('subscriber1').value = (firstname) + (" ") + (middlename) + (" ") + (lastname);
ff_getElementByName('subscriber1').readOnly = true;
}
else if (element.value != "SELF") {
ff_getElementByName('subscriber1').value = "";
ff_getElementByName('subscriber1').readOnly = false;
}
            break;
        default:;
    } // switch
} // ff_relationship1_action

Thank you

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

  • Page:
  • 1
  • 2
Time to create page: 0.122 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!