Serialzing a form...again

Take a look at this fiddle.
Click the edit button and then the add sign(plus icon)…a new input is added,look closer at the value of it’s name attribute.The reason for being like that is for serializing the specific input(and other inputs that might be added)…after serialization.ajax request sent I choose to change the name attr value to the form you see in the other (filled)inputs(code not shown).

Imagine this now:the user clicks edit and goes to modify the name of the existing services…so this content must be saved/serialized again.With the name attribute values being the way they are serialization cannot proceed…what can I do in such a case.

Various thoughts come in my mind…but I want to hear what you have to say.
Modifying again the values(to a serilaization-friendly format) is one choice…

I would say … use the same name format on all inputs and always treat a submitted value as new/edited.

1 Like

so…in other words I should not change the name format value at all.

correct. If you present data for editing, always assume the data were edited. Makes server-side treatment simpler.

If you have a lot of data, you could disable all datasets to begin with and if the user wants to edit them (e.g. by simply clicking in the field), enable it (but do not disable it afterwards).

I am afraid that this will not work either…consider this:
As we said the plan is that the name value must be in this form:form[5]…suppose that the user goes to add a service…there are already 3-4 registered…then what will happen is that ALL of the services will be serialized…while only the newly added must.
I have some alternatives in my mind but if you want comment the above…

I wouldn’t make a distinction between new service, edited service and not edited service … at least when you present them in the same view (which implies that you can add/edit/delete services at will). The most I’d do is disabling form elements (as described above).

I somehow got lost.Can you tell me if the example in the fiddle is how it should be according to your saying?

I do not quite understand the meaning of the above…just give me a hint.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.