EasyUI Forum
April 27, 2024, 05:05:30 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Init a DateBox  (Read 5927 times)
yamilbracho
Jr. Member
**
Posts: 64


View Profile Email
« on: November 01, 2014, 10:34:33 AM »

I am trying to read to a datebox
My datebox is defined as :

<input class="easyui-datebox"
      name="fe_nacimiento"
      required="true"
      data-options="formatter:myformatter, parser:myparser">

and the code to get from database

var urlData = './get_data.php';
$.get(urlData, function(response) {
   var response = eval('(' + response + ')');
            
   alert(response.fe_nacimiento);
   $("[name='fe_nacimiento']").datebox('setValue', response.fe_nacimiento);
})

The alert shows "2015-12-31", and the javascript console

Uncaught TypeError: Cannot read property 'options' of undefined

And the datebox is in blank. There are another fields that i bring from the database and
they are show in their text and combo boxes...

Any hint...

TIA
Yamil
Logged
yamilbracho
Jr. Member
**
Posts: 64


View Profile Email
« Reply #1 on: November 01, 2014, 01:20:48 PM »

Wow, I solved it!!!!
Just add an id to my datebox, say

<input class="easyui-datebox"
       id="fe_nacimiento"
   name="fe_nacimiento"
   required="true"
   data-options="formatter:myformatter, parser:myparser">

And change :
    $("[name='fe_nacimiento']").datebox('setValue', response.fe_nacimiento);
to
$('#fe_nacimiento').datebox('setValue', fechaNac);

It looks like JEasyUI works better if your add an id to your inputs...

Regards,
Yamil
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!