Joomla 5 Notice

We are pleased to announce that as of January 29, 2024, all of our Joomla extensions are compatible with Joomla 5.

For all who are still updateing from Joomla 3 to Joomla 4: Joomla 4 Migration instructions are available here:

There is now a separate Documentation for Visforms for Joomla 4 and for Visforms for Joomla 5!

Forum

Visforms Subscription user can ask questions in our forum. Please log in with the relevant user first.
Everybody can access the forum for reading.

Please only ask 1 question per topic.

Important information for almost every question:
V1: Which Visforms version is running?
V2: Which Joomla version is running?
V3: Which PHP version is running?

Duplicate multible fields

More
11 months 3 weeks ago #9891 by L_Cypherus
Duplicate multible fields was created by L_Cypherus
Hello,
I have a form where I have to add 84 times 2 fields to add.
Both with different (layout) settings and stuff.

If it possible to create 2 fields and then duplicate it 83 times to make it easier to add everything?

More
11 months 3 weeks ago #9892 by Administrator IV
Replied by Administrator IV on topic Duplicate multible fields
Hello L_Cypherus,

In your case there is only 1 way to copy fields in the desired way with all the respective settings.
This option is unofficial, but works very well.
If you are a little careful and pay attention, there can be no mistakes and it will work right away.

1 - You export a form with the two fields.
2 - You create a copy of the export file.
3 - You open the export file in an editor.
The export file consists of a single line.
4 - You replace {"id" with [New Line]{"id" in the export file.
[New line] = line break in the editor.
5 - You add a new line before the last three characters ]}].

Here is an example of the export file edited in this way from a form with submit button and reset button and 4 fields:

The 4 fields are at the end, each on its own line.
The lines are quite long and I have replaced the back of each line with '...' for readability.
Code:
[{"shape": {"id":47,"asset_id":0,"name":"json-edited-fields","title":"json-edited-fields", ... "fields":[ {"id":100,"fid":47,"asset_id":0,"name":"submit","label":"submit", ... }, {"id":101,"fid":47,"asset_id":0,"name":"reset","label":"reset", ... }, {"id":102,"fid":47,"asset_id":0,"name":"text-1","label":"text-1", ... }, {"id":103,"fid":47,"asset_id":0,"name":"number-1","label":"number-1", ... }, {"id":104,"fid":47,"asset_id":0,"name":"radio-1","label":"radio-1", ... }, {"id":105,"fid":47,"asset_id":0,"name":"field-separator-1","label":"field-separator-1", ... } ]}]

6 - Now you edit the form.
You add new fields by copying the desired field lines.
You customize the field ID so that the IDs are ascending and unique.
Ascending field IDs are not really necessary, but they make it easier to check the uniqueness of the field IDs when editing.
You can customize the field name and field label as desired.

Attention 1:
The field name must be unique.

Attention 2:
The last field line does not have a comma at the end of the line.
All other field lines above have a comma at the end of the line.

Attention 3:
You are not allowed to insert additional characters in the so-called JSON structure in places that are not enclosed by apostrophes.

Here is the edited example from above:
Code:
[{"shape": {"id":47,"asset_id":0,"name":"json-edited-fields","title":"json-edited-fields", ... "fields":[ {"id":100,"fid":47,"asset_id":0,"name":"submit","label":"submit", ... }, {"id":101,"fid":47,"asset_id":0,"name":"reset","label":"reset", ... }, {"id":102,"fid":47,"asset_id":0,"name":"text-1","label":"text-1", ... }, {"id":103,"fid":47,"asset_id":0,"name":"number-1","label":"number-1", ... }, {"id":104,"fid":47,"asset_id":0,"name":"radio-1","label":"radio-1", ... }, {"id":105,"fid":47,"asset_id":0,"name":"field-separator-1","label":"field-separator-1", ... }, {"id":106,"fid":47,"asset_id":0,"name":"text-2","label":"text-2", ... }, {"id":107,"fid":47,"asset_id":0,"name":"number-2","label":"number-2", ... }, {"id":108,"fid":47,"asset_id":0,"name":"radio-2","label":"radio-2", ... }, {"id":109,"fid":47,"asset_id":0,"name":"field-separator-2","label":"field-separator-2", ... } ]}]

7 - You remove all line breaks and save the file.
The export file now consists of a single line again.
8 - You import the edited file using the 'Import form definition' button in the button bar of the form list.

Option:
Basically, you can also change simple field properties and form properties in the file.
Simple field properties here means properties that do not implement any further logic when set in the field configuration interface, such as 'conditional fields'.

I implemented the whole thing successfully and was able to create a new form by importing the edited file.

Kind regards, Ingmar

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
The following user(s) said Thank You: L_Cypherus

More
11 months 3 weeks ago #9894 by Administrator IV
Replied by Administrator IV on topic Duplicate multible fields
Hello L_Cypherus,

You can also simply copy the two fields using the 'Batch' field action.
You always create 2 new fields per copy process.
Or you copy first 2, then 4, then 8, then etc. many fields.
vi-solutions.de/forum-uploads/copy-form-...eld-action-batch.png

With this method, however, you have to adjust the names of the copied fields individually.
However, with a large number of copy repetitions of the two fields, this is still a rather considerable effort.

However, the 'unofficial' method from the previous post is much easier and faster.

Kind regards, Ingmar

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).

More
11 months 1 week ago #9921 by L_Cypherus
Replied by L_Cypherus on topic Duplicate multible fields
Thanks. This is indeed a much easier method to use.

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum