[Vtigercrm-developers] Insert into db from jquery layout/template

Uma S uma.s at vtiger.com
Sun Jul 6 12:24:10 GMT 2014


Hi,

Yes, we can use the field-names as name of the html elements. So on form
submit these name will be mapped to entity database field-names. Please
look at (modules/Vtiger/actions/Save.php) file for
api getRecordModelFromRequest(). where we are mapping field-model
field-value to request field-value.


On Fri, Jul 4, 2014 at 6:36 PM, kkoci <kristian.koci at gmail.com> wrote:

> Hi, Forgive me if this is a noob question, I'm just broadening my depth of
> vtiger development knowledge...
>
> I need to insert data into a vtiger table, from a jquery code i'm doing for
> a module.
>
> To do that, i'm declaring all the fields on the manifest.xml , in the
> <sql></sql> section... Now, my question is:
>
> Should i give the same names I did in the manifest file, to the jquery form
> fields so automatically will save records into database?
>
> Or should I do something else?
>
> For example I have this on my Detail and List and Edit TPL's.
>
> <!DOCTYPE html>
> <html>
> <head>
> </head>
> <body>
> <div id="clonedInput1" class="clonedInput">
>         <div class="actions">
>         <button class="clone">Agregar pago</button>
>         <button class="remove">Quitar pago</button>
>     </div>
>     <div>
>         <label for="txtCategory" class="">Metodo *</label>
>         <select class="" name="txtCategory[]" id="metodo">
>             <option value="">Cheque</option>
>                         <option value="">Efectivo</option>
>                         <option value="">Credito</option>
>         </select>
>         <label for="txtCategory" class="">Referencia </label>
>             <input type="text" name="referencia"><br>
>                 <label for="meeting">Fecha de pago : </label><input
> id="meeting"
> type="date" />
>                 <label for="txtCategory" class="">Impuestos</label>
>                         <input type="text" name="impuestos"><br>
>     </div>
> </div>
>
> <link href="html2.css" rel="stylesheet">
>
>
>
> </body>
> </html>
>
> There's 'referencia' 'impuestos' and 'metodo' as id's and names of the
> fields, should it be enough with this? By adding them the same names or
> id's
> of the tables declared into manifest.xml?
>
> Should I do something more?
>
> What could that would be? Any example?
>
> I hope I've explained myself, Any help would be greatly appreciated, Thanks
> in advance!
>
> PS = I've seen some JQuery examples that use serializeArray() but i have no
> idea if i can use that inside a vtiger module, or how to map it into a
> vtiger table.
>
>
>
>
> --
> View this message in context:
> http://vtiger-crm.2324883.n4.nabble.com/Insert-into-db-from-jquery-layout-template-tp11259.html
> Sent from the vtigercrm-developers mailing list archive at Nabble.com.
> _______________________________________________
> http://www.vtiger.com/
>



-- 
With
Best Regards
Uma.S
Vtiger Team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20140706/1b801ce1/attachment.html>


More information about the vtigercrm-developers mailing list