Programmatically change element name

  • DavidLGCrawford
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 0

DavidLGCrawford created the topic: Programmatically change element name

Is there a way to change an elements name programatically?

I have a form (QuickForm mode) that has 20 questions for a guest. And I have 20 guests. So I created a section for guest #1, and entered all the elements. They are named like Guest1First, Guest1Last, Guest1Email, etc.
I then copy & pasted the guest 1 section to give me guest 2, 3, 4...20.
All good so far.
But for guest 2 the fields are named like "bfQuickMode52283".

Well it's really easy to change the NAME field in the database like this:
UPDATE `mr4yl_facileforms_elements` E INNER JOIN `mr4yl_facileforms_elements`G1 ON E.`title`=G1.`title` AND G1.name LIKE "Guest1%" SET E.`name`=REPLACE(G1.name,"1","9") WHERE E.id BETWEEN 526 AND 541;

But apparently the form doesn't look in the database for the element's name? Not sure why it's recorded in the DB if it's not retrieved from the DB.

So looking at the forms table there is a field called "template_areas" that has the elements' names in it. Two minutes in PHP and I've got a script to create a new template_areas field with the names from the elements table.

But again, that field in the DB isn't read either. So we have the element names recorded in _facileforms_forms.template_areas and in _facileforms_elements.name, but never read from those areas.

I really don't want to have to go through 400 fields and individually change their names, save, repeat ad infinitum.

Is there any way to get forms to rebuild their code by reading the information in the database?
#239393
  • DavidLGCrawford
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 0

DavidLGCrawford replied the topic: Programmatically change element name

Hello??
Is one of the developers around?
It's been 2 weeks, would like to know if this can be done. I need to get this form online.
#239645
  • Posts: 3125
  • Karma: 104
  • Thank you received: 410

mihaela replied the topic: Programmatically change element name

Hello,

First of all, sorry to keep you waiting.

What you are asking is not a default BreezingForms feature.
The best way is that you change the names manually. It gives elements names like "bfQuickMode52283" when copying the section because there can't be two elements with the same name in the form, so the form generates a name.

Regards,

Mihaela
#239658
  • DavidLGCrawford
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 0

DavidLGCrawford replied the topic: Programmatically change element name

Hi Mihaela,
Thanks for responding.
I understand why it generates a name as of course, you can't have two fields with the same name.
Since those names are stored in the database, maybe in the future you could include some form of "rebuild form from database" or such. Where BreezingForms will read the field names form the database, do it's magic, and you'd have the form. This way someone who is a programmer (or at least knows SQL) could do an SQL command to rename fields like in my example.
I have 22 fields (and growing) for 20 people. 440 fields that I had to change by hand. It was very time consuming (and open to errors). Especially since SQL could have renamed them all in a few minutes.
Obviously someone can ruin their form doing this wrong, but a simple "Make a copy first" warning should suffice.
Just a suggestion for the future.
#239705
Moderators: ForumSupporttomeperica
Time to create page: 0.070 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