Page 1 of 1

Copying Form controls and Name property

Posted: Tue Sep 22, 2020 1:33 pm
by WWBman
When copying and pasting a form control that has a Name property e.g. Editbox and TextArea the newly created control retains the same Name property instead of using the ID as the Name.

This shows in the email output but particularly in writing records to a MySQL database.
E.g. if you start with Editbox1 and copy it twice so creating Editbox2 and Editbox3 then 2 and 3 will each have a Name property of Editbox1.
The MySQL table will only have one data column with the name EDITBOX1 (from Editbox3 Name property) and contain the data from Editbox3.

Re: Copying Form controls and Name property

Posted: Tue Sep 22, 2020 2:46 pm
by Pablo
This is intentional behavior. Normally, a form has meaningful field names, like name, email, phone etc.
If you copy/paste this form to another page or project then in most cases you want to keep these names.

Re: Copying Form controls and Name property

Posted: Tue Sep 22, 2020 3:11 pm
by WWBman
If copying the form to another page then I agree you want to keep the names.
But copying and pasting e.g. editboxes in the same page and form surely should set Name the same as the ID to be consistent.

Re: Copying Form controls and Name property

Posted: Tue Sep 22, 2020 3:19 pm
by Pablo
Unfortunately, there is no way to detect if the object was copied from the current page or from another page.
On the Windows clipboard then is no 'context' information.

Re: Copying Form controls and Name property

Posted: Tue Sep 22, 2020 3:39 pm
by WWBman
I see, OK thanks.