TOPIC:

setInterval usage problem 1 month 3 days ago #267108

  • Topic Author
  • admin@horshamu3a.org.uk
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 19
  • Thanks: 0
I'm trying to copy 2 fields to one r/o field, using setInterval, as described in
crosstec.org/en/support/online-documenta...n-prior-element.html :
setInterval(ff_getElementByName("txtFullKnownAs").value=ff_getElementByName("fldFName").value + ' ' + ff_getElementByName("fldLName").value,500);

This is to reflect the common name of someone, and to offer the possibility that they can check a box and then enter their formal name in new textboxes.
e.g. someone known as Bob might want to enter Robert as their formal name.

How do I copy this information from 2 boxes to one box.

As expected, the code below doesn't work, as is suggested in the link above.
function ff_fldFName_action(element, action)
{
    switch (action) {
        case 'blur':
        case 'change':
            fname = ff_getElementByName('fldFName').value;
            lname = ff_getElementByName('fldLName').value;
            ff_getElementByName('hidFullKnownAs').value = fname + ' ' + lname;
            break;
        default:;
    } // switch
} // ff_fldFName_action
If I can't concatenate two fields like this, is there a way of putting two r/o fields, populated by setInterval, without labels on the same line?
Thanks, Mike

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

setInterval usage problem 1 month 2 days ago #267112

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

you don't need the code in actionscript of each field.

Instead of this, go to your form->Advanced->More options->Scripts->Initialization script->check Custom and put:
function ff_formname_init()
{
setInterval('calc()', 500);
} // ff_formname_init

function calc() {
ff_getElementByName('fulltext').value=ff_getElementByName('name').value + " " + ff_getElementByName('name2').value;
}
formname is name of form (not title)
name is name of first element
name2 is name of second element
fulltext is name of element in which you want to show copy of two field

Also, I create a small example:

File Attachment:

File Name: example1612.zip
File Size:6 KB


Please download, unzip and install it (BreezingForms->Configuration->package installer->select xml file->Install package, after that you will see form in Manage Forms).

Let me know if you need more help

Regards,
Tihana
Attachments:

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

setInterval usage problem 1 month 2 days ago #267124

  • Topic Author
  • admin@horshamu3a.org.uk
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 19
  • Thanks: 0
Hi Tihana
Thanks for that, I hadn't thought of putting a function in there.
Your example works fine, but when I put it into the main form, I get an error on typing text into the two fields- see attachments.
I'd like some guidance on how to debug this if possible.

In the Console, I get the error, and the number of errors increments by one per 0.5 secs.


In the source the issue is here:



The code is as per yours:
function ff_frmPayMembership_init() {
       setInterval('calc()', 500);
} // ff_frmPayMembership_init

function calc() {
// Live
ff_getElementByName('txtFullKnownAs').value = ff_getElementByName('fldLName').value + " " + ff_getElementByName('fldLName').value;
// Test
//ff_getElementByName('txtFullKnownAs').value = 'b' + " " + 'a';
}
I have tried making the source fields just two strings, and it works OK. accessing the properties of these two fields that's an issue.

I can let you have a login if that helps, or export the form.

Thanks for your help
Attachments:

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

setInterval usage problem 1 month 2 days ago #267125

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

please send me login information, and backend link

Use this tag:
[confidential]
[/confidential]

Please write name of form too

I will check what's wrong here

Regards,
Tihana

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

setInterval usage problem 1 month 2 days ago #267126

  • Topic Author
  • admin@horshamu3a.org.uk
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 19
  • Thanks: 0
Hi Tihana

The info is as follows
This message contains confidential information


I hope it doesn't turn out to be smth trivial :)
Thanks, Mike

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

setInterval usage problem 1 month 2 days ago #267128

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

solved!

I changed names of fields for last, first, and recorded name, all with lowercase, and it works now :)

Let me know if you need anything else

Regards,
Tihana

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

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