Using server methods from a form with many fields


#1

Hi,

I wish to call CRUD server side methods.
Within these methods, I already need to explicitly check each field.
(The form could have many fields and everytime I would add a new field, I would need to add code in the event handler as well as the server side method)

But from the calling side, do I need to explicitly define the “tag:value” for each field present on the form,
or there is a away to “scan” every tag and value present in the event handler’s parameter?
(so that I can send them to the method without noninclusive hard coding (need for coding) if there is new fields added to the form)

Thanks
Marc


#2

You can use something like https://atmospherejs.com/pcel/serialize to serialize all your form inputs into one object and pass through to your method at once.


#3

have you looked at autoForm? the learning curve is well worth it in our experience. Saves you a ton of time writing all this validate and crud stuff by hand each time.