Categories | Question details Back To List | ||
How to insert a new field value to database when a custom section is created(dhtmlxscheduler)? Hi, i have created a custom section inorder to add two text fields and a hidden field in the event window of dhtmlxscheduler by referring the samples given in custome_detail_form. The script is as follows: scheduler.form_blocks["my_editor"]={ render:function(sns){ return "<div class='dhx_cal_ltext' style='height:60px;'>SMS <input type='text'><br/>email <input type='text'><input type='hidden'></div>"; }, set_value:function(node,value,ev){ node.childNodes[1].value=value||""; node.childNodes[4].value=ev.details||""; }, get_value:function(node,ev){ ev.location = node.childNodes[4].value; return node.childNodes[1].value; }, focus:function(node){ var a=node.childNodes[1]; a.select(); a.focus(); } } scheduler.config.lightbox.sections=[ { name:"description", height:200, map_to:"text", type:"textarea" , focus:true}, {name:"recurring", height:115, type:"recurring", map_to:"rec_type", button:"recurring"}, { name:"detail", height:80, type:"my_editor" , map_to:"my_editor", focus:false}, { name:"time", height:72, type:"time", map_to:"auto"} ] now i want to get the customer entered text field value in the server side (in java code) . And want to insert these values in database through insert_query () function .what modification are to be made in code for inserting a new field values to the database. thank you rencin. Answer posted by Alex (support) on Nov 04, 2009 05:50 Hello, please see the article http://www.dhtmlx.com/dhxdocs/doku.php?id=dhtmlxconnectorjava:event_beforeupdate If you want to save location field, the code can be the following: class updateBehavior extends ConnectorBehavior{ private GridConnector conn; public updateBehavior(GridConnector conn){ this.conn = conn; } @Override public void beforeUpdate(DataAction action) { String location = data.get_value("location"); String id = data.get_value("id"); conn.sql.query("UPDATE some_table SET location='"+location+"' where id="+id); data.success(); } } conn.event.attach(new updateBehavior(conn)); |