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