EasyUI Forum
May 04, 2024, 03:39:00 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  General Category / EasyUI for jQuery / How to serverside validation in CRUD DataGrid on: February 16, 2016, 08:44:36 PM
Hi All,

when I input student ID to CRUD DataGrid (add/update) record  studentID field.
how to serverside validation studentID field?

thank you very much!
2  General Category / EasyUI for jQuery / Editable DataGrid cell follow by [arrow key] on: March 17, 2014, 02:41:28 AM
How can move Editable DataGrid cell follow by [arrow key]?

Code:
	<script type="text/javascript">
$(function(){
$('#tt').edatagrid({
autoSave: true,
url: 'add.php',
saveUrl: 'save.php',
updateUrl: 'update.php',
destroyUrl: 'destroy.php'
});
});
</script>
<table id="tt" style="width:600px;height:200px"
        title="Editable DataGrid"
        singleSelect="true">
    <thead>
        <tr>
            <th field="itemid" width="100" editor="{type:'validatebox',options:{required:true}}">Item ID</th>
            <th field="productid" width="100" editor="text">Product ID</th>
            <th field="listprice" width="100" align="right" editor="{type:'numberbox',options:{precision:1}}">List Price</th>
            <th field="unitcost" width="100" align="right" editor="numberbox">Unit Cost</th>
            <th field="attr1" width="150" editor="text">Attribute</th>
        </tr>
    </thead>
</table>

3  General Category / EasyUI for jQuery / Re: How to set easyui-datebox can click Monday only & can't select > today on: March 10, 2014, 08:15:47 PM
Thank you very much! stworthy
4  General Category / EasyUI for jQuery / How to set easyui-datebox can click Monday only & can't select > today on: March 06, 2014, 08:38:08 PM
Hi All,

How to set easyui-datebox
Q1. User can click Monday only
Q2. User can't select > today.

THS!!

5  General Category / General Discussion / Re: [Please Help!] Submit form using linkbutton problem. on: March 04, 2014, 07:04:28 PM
OK !
Thank you for your reply !! Smiley
6  General Category / General Discussion / [Please Help!] Submit form using linkbutton problem. on: March 03, 2014, 02:35:45 AM
This is Submit form code
Index.php
Code:
    <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>&nbsp;</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:
Code:
<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:
Code:
<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
Code:
<!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>
7  General Category / EasyUI for jQuery / About Form data & click submit post to php file. on: January 22, 2014, 02:17:14 AM
Dear All,

I use easyui-linkbutton submit to post data to checklogin.php, but doesn't work.
Anyone can help me ?

Code:
<link rel="stylesheet" type="text/css" href="themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="themes/icon.css">
<script type="text/javascript" src="plugins/jquery-1.7.2.js"></script>
<script type="text/javascript" src="plugins/jquery.easyui.min.js"></script>


</head>

<body>
<h1>Login</h1>

<!--
<div class="demo-info">
<div class="demo-tip icon-tip"></div>
</div>
!-->
<div style="margin:10px 0;"></div>
<div class="easyui-panel" title="Login System" style="width:400px;padding:10px">
<form action="checklogin.php" method="post" id="flogon" >
<table>
<tr>
<td>Staff ID:</td>
<td><input class="easyui-validatebox" id="staffid" name="staffid" required="true" missingMessage="Please input your Staff ID!"></td>

</tr>
<tr>
<td>Password:</td>
<td><input name="upassword" type="password" class="easyui-validatebox" id="upassword" data-options="required:true"></td>
</tr>
<tr>
<td>
</td>
</tr>
</table>

</form>
    <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>
    <script>
    function submitForm(){
    $('#flogon').form('submit');
    }
    function clearForm(){
    $('#flogon').form('clear');
    }
    </script>
8  General Category / EasyUI for jQuery / Re: [Help!] Editing in DataGrid after change cell, can't updateurl (php) on: January 20, 2014, 09:05:30 PM
stworthy,

thank you for your reply.
9  General Category / EasyUI for jQuery / [Help!] Editing in DataGrid after change cell, can't updateurl (php) on: January 20, 2014, 07:57:19 PM
Hi All,

I use edatagrid to updateUrl: (php file & update mysql), but not working.

Please help & tell me, what's wrong in staffupdatedata.php / staffrecord.html both file.

url: 'staffgetdata.php',  <-- Sucess
saveUrl: 'staffsavedata.php', <-- Sucess
updateUrl: 'staffupdatedata.php', <-- not working & no change in database
destroyUrl: 'staffdestroydata.php' <-- Sucess


staffrecord.html
Code:
	<title>Staff Record</title>
<link rel="stylesheet" type="text/css" href="themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="themes/icon.css">
<script type="text/javascript" src="plugins/jquery-1.7.2.js"></script>
<script type="text/javascript" src="plugins/jquery.easyui.min.js"></script>
<script type="text/javascript" src="plugins/jquery.edatagrid.js"></script>
<script type="text/javascript">
$(function(){
$('#frm_staffrec').edatagrid({
autoSave: true,
url: 'staffgetdata.php',
saveUrl: 'staffsavedata.php',
updateUrl: 'staffupdatedata.php',
destroyUrl: 'staffdestroydata.php'
});
});
</script>
</head>
<body>
<h1>Staff Record</h1>

    <div id="toolbar">
        <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="javascript:$('#frm_staffrec').edatagrid('addRow')">New</a>
        <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="javascript:$('#frm_staffrec').edatagrid('destroyRow')">Destroy</a>
        <a href="#" class="easyui-linkbutton" iconCls="icon-save" plain="true" onclick="javascript:$('#frm_staffrec').edatagrid('saveRow')">Save</a>
        <a href="#" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="javascript:$('#frm_staffrec').edatagrid('cancelRow')">Cancel</a>
    </div>
<table id="frm_staffrec" style="width:600px;height:600px" idField="dr_staffcode" url="staffgetdata.php"
    toolbar="#toolbar" pagination="true" rownumbers="true" fitColumns="true"
    title="Staff Data (double click to edit)" singleSelect="true">

<thead>
<tr>
<th field="dr_staffcode" width="100" editor="{type:'validatebox',options:{required:true}}">Staff Code</th>
<th field="dr_staffname" width="100" editor="{type:'validatebox',options:{required:true}}">Staff Name</th>
<th field="dr_stafflevel" width="80" editor="numberbox">Staff Level</th>
    <th field="dr_staffemail" width="150" editor="{type:'validatebox',options:{required:true,validType:'email'}}">Email</th>
<th field="dr_staffactive" width="50" editor="numberbox">Active</th>
<!--
<th field="dr_staffcard" width="100" align="right" editor="{type:'numberbox',options:{precision:1}}">List Price</th>
<th field="unitcost" width="100" align="right" editor="numberbox">Unit Cost</th>
!-->

</tr>
</thead>
</table>
</body>
</html>

staffupdatedata.php
Code:
<?php

$id 
$_REQUEST['id'];
$dr_staffcode $_REQUEST['dr_staffcode'];
$dr_staffname $_REQUEST['dr_staffname'];
$dr_stafflevel $_REQUEST['dr_stafflevel'];
$dr_staffemail $_REQUEST['dr_staffemail'];
$dr_staffactive $_REQUEST['dr_staffactive'];
$dr_staffcarda trim($_REQUEST['dr_staffcode']," ");
$dr_staffcard $dr_staffcarda."0%T";

include 
'mysqlconfig.php';

$sql "update dr_staff set dr_staffcode=$dr_staffcode, dr_staffname=$dr_staffname, dr_stafflevel=$dr_stafflevel, dr_staffemail=$dr_staffemail, dr_staffactive=$dr_staffactive, dr_staffcard=$dr_staffcard where dr_staffcode='$id'";
@
$db->query($sql);
echo 
json_encode(array(
'dr_staffcode' => $id,
'dr_staffname' => $dr_staffname,
'dr_stafflevel' => $dr_stafflevel,
'dr_staffemail' => $dr_staffemail,
'dr_staffactive' => $dr_staffactive
));

?>


staffgetdata.php

Code:
<?php
include 'mysqlconfig.php';

$myArray = array();
if (
$result $db->query("SELECT * FROM dr_staff")) {
$tempArray = array();
while($row $result->fetch_object()) {
$tempArray $row;
array_push($myArray$tempArray);
}
echo json_encode($myArray);
}
$result->close();
$db->close();


?>
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!