Title: [Please Help!] Submit form using linkbutton problem.
Post by: kg on March 03, 2014, 02:35:45 AM
This is Submit form code Index.php <form action="insert_data.php" method="post" name="ff" id="ff"> <div style="margin:10px 0;"></div> <div class="easyui-panel" title="Please input data" style="width:800px;height:600px;padding:45px;"> <div class="easyui-layout" data-options="fit:true"> <div data-options="region:'north',title:'Input Data ',collapsible:false" style="height:125px;padding:10px"> <table> <tr> <td>ID:</td> <td><input name="ID" type="text" class="easyui-validatebox" size="15" data-options="required:true"></input></td> <td> </td> <td>Date:</td> <td><input name="date" class="easyui-datebox" size="15" data-options="required:true,formatter:myformatter,parser:myparser"></input> <script type="text/javascript"> function myformatter(date){ var y = date.getFullYear(); var m = date.getMonth()+1; var d = date.getDate(); return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d); } function myparser(s){ if (!s) return new Date(); var ss = (s.split('-')); var y = parseInt(ss[0],10); var m = parseInt(ss[1],10); var d = parseInt(ss[2],10); if (!isNaN(y) && !isNaN(m) && !isNaN(d)){ return new Date(y,m-1,d); } else { return new Date(); } } </script> </td> </tr> </table> </div> </div> </div> <div style="text-align:center;padding:5px"> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">Submit</a> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">Clear</a> </div> </div> </form> <script> function submitForm(){ $('#ff').form('submit'); } function clearForm(){ $('#ff').form('clear'); } </script>
server response is: "OK" the problem is: if the submit button is: <input type="submit" value="Submit"> then form $POST send to insert_data.php shows ok and change to insert_data.php and show result, but skip easyui-validatebox checking. if this submit is: <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">Submit</a> then form easyui-validatebox checking is work and $POST is ok , but cannot change to insert_data.php and show result page insert_data.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Resuit</title> </head>
<body>
<?php echo "<BR>". $_POST['id']; echo "<BR>". $_POST['date']; ?> </body> </html>
Title: Re: [Please Help!] Submit form using linkbutton problem.
Post by: stworthy on March 04, 2014, 12:37:35 AM
When using 'submit' method of form, you are submitting a form via ajax. When submit successfully, the 'success' callback function will be called. You need to determine what to do in this function. $('#ff').form('submit', { success:function(data){ //... } });
Title: Re: [Please Help!] Submit form using linkbutton problem.
Post by: kg on March 04, 2014, 07:04:28 PM
OK ! Thank you for your reply !! :)
Title: Re: [Please Help!] Submit form using linkbutton problem.
Post by: frankz on November 16, 2017, 07:46:03 PM
I say that they are at the beginning. I'm experiencing the same problem, but I can not figure out what to put in the function {date} {...} to send the data to the server-side php file.
|