Autor Tema: (tema solucionado ) fomato datebox jquery  (Leído 4026 veces)

0 Usuarios y 1 Visitante están viendo este tema.

aedEric

  • Megabyte
  • ***
  • Mensajes: 211
  • Reputación: +20/-0
    • Ver Perfil
(tema solucionado ) fomato datebox jquery
« en: Abril 13, 2015, 08:14:15 pm »
hola atodos yo se que esto es para php pero tal vez alguien me pueda orientar tengo un CRUD utilizando jquery  veran tengoun campo date en my base y ocupo un datebox para ingresar la fecha pero no he podido validarlo ni tampoco y podido hacer que cuando me carge los datos para editar me tome este formato "dd-mm-YYYY" ya que me toma este formato "mm-dd-YYYY" de antemano agradecere cualquier opinion o sugerencia de antemano muchas gracias

Código: (PHP) [Seleccionar]
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basic CRUD Application - jQuery EasyUI CRUD Demo</title>
<link rel="stylesheet" type="text/css" href="lib/themes/metro/easyui.css">
<link rel="stylesheet" type="text/css" href="lib/themes/icon.css">
<link rel="stylesheet" type="text/css" href="lib/themes/color.css">
<link rel="stylesheet" type="text/css" href="lib/demo.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>
<script type="text/javascript" src="lib/jquery.easyui.min.js"></script>
</head>
<body>
<h2>Basic CRUD Application</h2>
<p>Click the buttons on datagrid toolbar to do crud actions.</p>

<table id="dg" title="My Users" class="easyui-datagrid" style="width:700px;height:250px"
url="get_users.php"
toolbar="#toolbar" pagination="true"
rownumbers="true" fitColumns="true" singleSelect="true">
<thead>
<tr>
<th field="nombre" width="70">nombre</th>
<th field="lugar" width="70">lugar</th>
<th field="concepto" width="70">Concepto</th>
<th field="ident" width="70">ident</th>
<th field="servicio" width="70">servicio</th>
<th field="fecha" width="50">fecha</th>
</tr>
</thead>
</table>
<div id="toolbar">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUser()">New User</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editUser()">Edit User</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyUser()">Remove User</a>
</div>

<div id="dlg" class="easyui-dialog" style="width:400px;height:380px;padding:10px 20px"
closed="true" buttons="#dlg-buttons">
<div class="ftitle">User Information</div>
<form id="fm" method="post" novalidate>
<div class="fitem">
<label>Nombre:</label>
<input name="nombre" class="easyui-textbox" required="true">
</div>
<div class="fitem">
<label>Lugar:</label>
<input name="lugar" class="easyui-textbox" required="true">
</div>
<div class="fitem">
<label>Concepto:</label>
<input name="concepto" class="easyui-textbox" data-options="multiline:true" style="height:60px">
</div>
<div class="fitem">
<label>Email:</label>
<input name="ident" class="easyui-textbox" validType="date">
</div>
    <div class="fitem">
<label>Servicio:</label>
<input  name="servicio" class="easyui-combobox" data-options="
valueField: 'label',
textField: 'value',
data: [{
label: 'compra',
value: 'compra'
     },{
     label: 'venta',
     value: 'venta'
     },{
     label: 'renta',
     value: 'renta'
     }]" />
     </div>
     <div class="fitem">
<label>FECHA:</label>
<input name="fecha" class="easyui-datebox" validType="date">
</div>
  </form>
</div>
<div id="dlg-buttons">
<a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveUser()" style="width:90px">Save</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
</div>
<script type="text/javascript">
var url;

function newUser(){
$('#dlg').dialog('open').dialog('setTitle','New User');
$('#fm').form('clear');
url = 'save_user.php';
}
function editUser(){
var row = $('#dg').datagrid('getSelected');
if (row){
$('#dlg').dialog('open').dialog('setTitle','Edit User');
$('#fm').form('load',row);
url = 'update_user.php?id='+row.id;
}
}
function saveUser(){
$('#fm').form('submit',{
url: url,
onSubmit: function(){
return $(this).form('validate');
},
success: function(result){
var result = eval('('+result+')');
if (result.errorMsg){
$.messager.show({
title: 'Error',
msg: result.errorMsg
});
} else {
$('#dlg').dialog('close'); // close the dialog
$('#dg').datagrid('reload'); // reload the user data
}
}
});
}
function destroyUser(){
var row = $('#dg').datagrid('getSelected');
if (row){
$.messager.confirm('Confirm','Are you sure you want to destroy this user?',function(r){
if (r){
$.post('destroy_user.php',{id:row.id},function(result){
if (result.success){
$('#dg').datagrid('reload'); // reload the user data
} else {
$.messager.show({ // show error message
title: 'Error',
msg: result.errorMsg
});
}
},'json');
}
});
}
}

</script>
<style type="text/css">
#fm{
margin:0;
padding:10px 30px;
}
.ftitle{
font-size:14px;
font-weight:bold;
padding:5px 0;
margin-bottom:10px;
border-bottom:1px solid #ccc;
}
.fitem{
margin-bottom:5px;
}
.fitem label{
display:inline-block;
width:80px;
}
.fitem input{
width:160px;
}
</style>
</body>
</html>

el campo que intento validar es fecha de mi form es un datebox de antemano agradecere cualquier sugerencia opinion mil gracias
« última modificación: Abril 15, 2015, 10:02:00 pm por aedEric »
No he fracasado. He encontrado 10000 soluciones que no funcionan.

aedEric

  • Megabyte
  • ***
  • Mensajes: 211
  • Reputación: +20/-0
    • Ver Perfil
Re:fomato datebox jquery
« Respuesta #1 en: Abril 15, 2015, 10:01:32 pm »
 ;D tema solucionado
No he fracasado. He encontrado 10000 soluciones que no funcionan.

Truysc

  • Bytes
  • *
  • Mensajes: 10
  • Reputación: +0/-0
    • Ver Perfil
Re:(tema solucionado ) fomato datebox jquery
« Respuesta #2 en: Julio 02, 2015, 11:32:47 am »
¿Cómo lo hiciste finalmente?
Look around... and.... SEE!!