Developer forum

Forum » CMS - Standard features » Repeated systemNames in Forms for Editors - Dynamicweb 9

Repeated systemNames in Forms for Editors - Dynamicweb 9

Lara Arsénio
Reply
 
Description - The Forms for Editors App is accepting / creating duplicated systemNames, when duplicating fields.
Discovered this when having to mannualy configure a form with 50 custom fields, all with SystemNames previously defined by the customer. 
These 50 fields represent 10 equal sets of 5 fields - on wich only SystemNames vary.
In the Code, I declare each "row" of fields, passing an array with the fieldNames to display.
@RenderBlanketOrderProductFields(new string[] {"00Nf400000O1dXq", "00Nf400000O1dYe", "00Nf400000O1dZN", "00Nf400000O1daV", "00Nf400000O1db9", "00Nf400000O1dbn"}, fields)
This way, it will only output the fields in which the SystemName match the given array of system names, that is how i realised this error, otherwise it would pass, and we would be outputting a series of repeated fields, that is not valid for forms.
To ease/fasten the configuration, after the first set was configured, I start to duplicate each set and then change the SystemName accordingly to documentation.
After finishing the full configuration, I notice a lot of gaps (missing form fields) and start to verify if all the system names were set correctly, and start to find (too)many with switched system names in the backend.
Start to correct the wrong ones, and, after each one I correct and save, some other field disappears from the front end. That is when i realize that it was not all "human (my) error" but the fact that the backend seems to be messing with the ID's, in different ways:
- Allowing 2 fields to have the same systemName - this needs to be validated in the backend when saving configurations
- When Changing one of the duplicated system names, the other clone, sometimes(*), changes too. Which means, that even if a person realizes the error, it becomes very tricky to resolve.
- The fact that this happens only sometimes, and the fact that there where so many repeated SystemNames, the first time this error happened to me, gave me the sensation that sometimes, the field saving overlaps - meaning that while saving changes to a field, a previously edited one is still "in memory" or being saved, and their attributes get messed.
 
Here are 3 videos where I replicate the configuration steps and the error - hope it helps:
 
-> Step 1 - Duplicate existing set of fields https://www.useloom.com/share/0f9c71fb0ffa49ef9d5c2c3dfc8b395b
-> Step 2 - Reposition these fields by dragging them to the wanted position. https://www.useloom.com/share/b34cd92e2edb4d599385fcbc72311f1c
-> Step 3 - Starting to edit the cloned fields and verify Output:
Part of the fields get the same systemName as the original, when duplicated. Then, when one of the duplicated names is fixed, the "clone"  gets the change too (and in this case, due to my code structure, gets invisible). To ease the debug and make the videos comprehensible, the expected systemName is outputted above each input. https://www.useloom.com/share/88f0dce49ad44d76b1e68b65e999b194
 
So, I have 2 Requests:
- Please validate/prevent repeated SystemNames.
- Would be nice to have an Import (right next to "export") in "Forms for editor"?  To avoid manual copy of extensive forms from Dev to Prod environment? - The lack of it was useful to identify this problem, but really increases the time of deployment.
 

Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Lara

Thank you for your ellaborate post.

When you use the UI in Dynamicweb to create fields, it will ensure that systemnames are unique. If you choose to overwrite them using the layout dialog we allow duplicates - that is actually a feature and by design. Here is why: We have scenarioes with i.e. multiple fields that shares the same system name to overwrite who receives the form email for one example. And there are many other custom scenarios like the one you have, that will require duplicate system names where custom code is used to pickup the form submit.

When you duplicate (copy field) in the UI, it will add the auto id of the field to the systemname of the field you duplicate.

I've made one change though - I've added the systemname to the list of fields when in list mode making it more simple to see in these kind of scenarios.

Good idea to import/export forms. Should be fairly easy to do. Also an option to deploy forms using the deployment tool.

Thanks, Nicolai

Votes for this answer: 1
 
Lara Arsénio
Reply

Thank you, Nicolai.

 
Lara Arsénio
Reply

Hello. I Am Getting back to this question because  there is a pending issue: 

- The fact that, when we change systemName of one field, other fields get their id switched/messed up.

Here goes another video - that i started recording after duplicating a few more fields in the same form.

There you can see that everytime one id is changed, other fields around disappear (which means their id changed)

https://www.useloom.com/share/fa3d8250c6184bdfaf1c0bb24ec1994c

Please take a look into this issue, because we need to make sure that when changing a field, the changes apply to that field only, and no other.

Thanks in advance!

 

 
Nicolai Pedersen
Reply

Hi Lara

I am not sure I understand how your video shows that systemnames are changed on other records. It could be you template code...

I've looked at the database for this solution running the SQL scripts below.

The first shows a list of the last edited fields - and as you can see only one field is updated each time you save something. (See dump#1)

If you look at the other SQL, you get a list of duplicate systemnames on that form - you have a couple - not sure that is part of the issue. (See dump#2)

I cannot reproduct systemnames of other fields gets updated when editing another field. You can run this SQL against the field (or fields) that you believe gets altered when you edit another field. Look at the systemname column if it changes when editing another field:

SELECT [FormFieldID],[FormFieldFormID] ,[FormFieldName],[FormFieldType],[FormFieldSystemName],[FormFieldCreatedDate],[FormFieldUpdatedDate]
FROM FormField]  where [FormFieldID] = 1

SQL for dump1:

SELECT TOP (1000) [FormFieldID]
      ,[FormFieldFormID]
      ,[FormFieldName]
      ,[FormFieldType]
      ,[FormFieldSystemName]
      ,[FormFieldCreatedDate]
      ,[FormFieldUpdatedDate]
      ,[FormFieldCreatedBy]
      ,[FormFieldUpdatedBy]
  FROM [FormField]
  where [FormFieldFormID] = 42
  order by [FormFieldUpdatedDate] desc

SQL for dump2:

  SELECT top 1000 [FormFieldSystemName], count([FormFieldSystemName]) as counter
  FROM [FormField]
  where [FormFieldFormID] = 42
  group by [FormFieldSystemName]
  order by count([FormFieldSystemName]) desc

Capture.PNG Capture2.PNG

 

You must be logged in to post in the forum