Need to Ensure the workflow about web form, we believe Web form attribute works inappropriately

Please check the below scenario

We have one doctype with minimal attributes.

we created a new web form for the corresponding doctype, while creating a form, we gave the same field multiple times.

Please refer to the below screenshot for the creation of the web.

[Screenshot by Lightshot]

the resultant webform shows like below screenshot

[Screenshot by Lightshot]

I have entered three different values for each “Event Note” text box.
After submission of the data, we have checked the corresponding record through the admin desk, I can see only the last entered event note value.

Please check the below screenshot as well for more info

[Screenshot by Lightshot]
[Screenshot by Lightshot].

Share the comments.

Thanks in advance.

Hi @Navaneethakrishnan_K,
The scenario you are attempting is not possible. (Not just in ERPNext, but in any ORM solution)

This is because, for every doctype that you create, the frappe framework creates a new table in mysql database on the back-end. The table has only one column named event_note to store the value.

The webform is nothing but a new user interface for your doctype & the values you enter in the webform is ultimately inserted in the table at the back-end which in turn has only on column named event_note. Therefore when you submit the webform, only the last event_note value gets inserted in the database table.

Instead, you should add two more fields in your custom doctype as even_note_2 & event_note_3.
In the webform/doctype you could have same labels as event note.

I hope you are able to resolve your problem.

1 Like

Hi @Navaneethakrishnan_K,

A better way to implement this would be by using Child Tables in the main DocType.
You can then get the field in the web form. You can then collect data for multiple event notes in the form of child table.

Even simpler workaround is what @vipultagai suggested. Simply create three different fields in the main DocType and collect separate data points.

1 Like

Thank you @shashank_shirke @vipultagai for your valuable responses.

I understood the workflow of the webform.

I have one more concern, assume that I have two different web forms for the same doctype. can we separate the submitted results belonging to form 1 and form 2 respectively?

Again, a work around to achieve it is to add one data field in the doctype.

say, webform_type

While creating the two different Webforms, you could set default values in Webforms as Form-1 & Form-2, in the field settings. Also make the field hidden.

There you go! One Doctype two Webforms :v: