Cant get a time object value in a text box

27 views
Skip to first unread message

SK

unread,
Jan 15, 2013, 2:24:32 AM1/15/13
to erpnext-dev...@googlegroups.com
Hi ERPNext Developers,

Well i have a custom field time picker object , to be displayed in a text box. But today i found out interface of timer object is changed and now its not working as before.

The time is not displayed in the textbox

Current Scenario:-.

When i press button(check_in) ,  the value in time object(in_time) should go to a text box(text_time).

Here is code:-

cur_frm.cscript.check_in = function(doc) {

doc.text_time=doc.in_time


}

It used to work before , but presently its showing null.

When i tried to

alert(doc.in_time);

it gives the message undefined object.

What i need;-

I need the time object value in a textbox

Anyone can help me out on this.

Sharhan

Rushabh Mehta

unread,
Jan 15, 2013, 3:53:08 AM1/15/13
to erpnext-dev...@googlegroups.com
Shahran,

Are you sure the value for doc.in_time is set?

- Rushabh



--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/MxgozwzzisgJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--



Twitter: @rushabh_mehta

SK

unread,
Jan 15, 2013, 4:00:47 AM1/15/13
to erpnext-dev...@googlegroups.com
Rusabh,

Yes i have done the same.

Is it still doc.textpickerobjectname to pick timer object values.

Sharhan

Rushabh Mehta

unread,
Jan 15, 2013, 4:02:44 AM1/15/13
to erpnext-dev...@googlegroups.com
Shahran,

Still not able to understand.

Can you post the entire code on Gist or pastebin?

- Rushabh


--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

SK

unread,
Jan 15, 2013, 4:13:10 AM1/15/13
to erpnext-dev...@googlegroups.com
Hi Rusabh,

Please find the link and screenshot attached.

http://pastebin.com/WWhG6X1g


Thanks

Sharhan

On Tuesday, January 15, 2013 12:54:32 PM UTC+5:30, SK wrote:
SS_ERPNext.jpg

Rushabh Mehta

unread,
Jan 15, 2013, 4:22:17 AM1/15/13
to erpnext-dev...@googlegroups.com
That does not tell me anything - where does the original value come from?


--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

SK

unread,
Jan 15, 2013, 4:26:44 AM1/15/13
to erpnext-dev...@googlegroups.com
Rusabh,

Just dont go too deep.

I just need a time pickers value in a text box.

thats it.

Can you help me with it.



Sharhan


On Tuesday, January 15, 2013 12:54:32 PM UTC+5:30, SK wrote:

Rushabh Mehta

unread,
Jan 15, 2013, 4:31:35 AM1/15/13
to erpnext-dev...@googlegroups.com
Can't help you if I can't understand the problem :(

Anyways - just pushed an update where time values are set automatically as it was before.


--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

SK

unread,
Jan 15, 2013, 5:14:40 AM1/15/13
to erpnext-dev...@googlegroups.com
Rusabh,

I am not able to pick time , or choose time as i want using time object.

Its getting automatically picked , some randome time.
Else could we have a call regarding this.


Sharhan


On Tuesday, January 15, 2013 12:54:32 PM UTC+5:30, SK wrote:

Anand Doshi

unread,
Jan 15, 2013, 5:20:47 AM1/15/13
to erpnext-dev...@googlegroups.com
Hi Sharhan,

Are you able to use the time picker widget and set time? or even that is not working?

Thanks,
Anand.

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.

SK

unread,
Jan 15, 2013, 5:28:01 AM1/15/13
to erpnext-dev...@googlegroups.com
Anand,

i will tell you the thing.

I am able to use the time picker object
I am able to set the time , and its diplaying the same time, what i selected.
But when i try it to display the time in a message box in java script
ie just giving

alert(doc.timepickerobjectname)
;

its showing time of now. not which is set.

If you are ready i am readily able to give my tv access

Sharhan.


On Tuesday, January 15, 2013 12:54:32 PM UTC+5:30, SK wrote:

Anand Doshi

unread,
Jan 15, 2013, 5:35:27 AM1/15/13
to erpnext-dev...@googlegroups.com
Hi,

Have you tried using:
cur_frm.cscript.check_in = function(doc) {
// set_value will set the value and also refresh the field in the view
cur_frm.set_value("in_time", wn.datetime.get_cur_time());
}

Thanks,
Anand.

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.

SK

unread,
Jan 15, 2013, 5:46:50 AM1/15/13
to erpnext-dev...@googlegroups.com
Anand,

Please find the screen shot and code which is given below

And help me if you could

cur_frm.cscript.edit_check_in = function(doc) {

var sr =doc.edit_check_in_time
alert(sr);

}

Please see the SS for more information

In Screenshot you could see i set time as 9:13 but  when i click the button edit check in ......it is showing 16:13

Sharhan


On Tuesday, January 15, 2013 12:54:32 PM UTC+5:30, SK wrote:
SS_ERPNext.jpg

Anand Doshi

unread,
Jan 15, 2013, 5:58:52 AM1/15/13
to erpnext-dev...@googlegroups.com
Hi Sharhan,

Open your browser's console and type this:

cur_frm.doc.edit_check_in_time

Are you getting 09:13:58 or 16:13:58?

Thanks,
Anand.

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 
<SS_ERPNext.jpg>

SK

unread,
Jan 15, 2013, 6:03:22 AM1/15/13
to erpnext-dev...@googlegroups.com

Anand

it is showing 16:13:58.


Sharhan


On Tuesday, January 15, 2013 12:54:32 PM UTC+5:30, SK wrote:

Anand Doshi

unread,
Jan 15, 2013, 6:13:50 AM1/15/13
to erpnext-dev...@googlegroups.com
Hi Sharhan,

When setting a field's value in client, use cur_frm.set_value(field name, value)
This will set the field value in model as well as the view i.e. it will refresh the view automatically.

In your case, the field value got set in model but the field value in the display was not updated.

Use cur_frm.set_value("abc", doc.xyz) instead of directly assigning like doc.abc = doc.xyz

Thanks,
Anand.

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.

SK

unread,
Jan 15, 2013, 6:30:30 AM1/15/13
to erpnext-dev...@googlegroups.com
Anand,

As you suggested in the last reply, i did the same.

I created one  text field called tempdata and i tried to assign that value to the tempdata. But i am unable to again set the value, the problem still exit.

Please find the code

cur_frm.cscript.edit_check_in = function(doc) {
cur_frm.set_value("tempdata", doc.edit_check_in_time)
alert(doc.tempdata);

}

Kindly waiting for your suggestion


Sharhan
On Tuesday, January 15, 2013 12:54:32 PM UTC+5:30, SK wrote:

Anand Doshi

unread,
Jan 15, 2013, 7:07:47 AM1/15/13
to erpnext-dev...@googlegroups.com
Hi Sharhan,

There was a bug we just fixed for time field. Please go to Tools > Clear Cache & Refresh and then try again.

Thanks,
Anand.


--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To unsubscribe from this group, send email to erpnext-developer...@googlegroups.com.

SK

unread,
Jan 15, 2013, 7:24:37 AM1/15/13
to erpnext-dev...@googlegroups.com
Anand,

Thanks . It worked


Sharhan

On Tuesday, January 15, 2013 12:54:32 PM UTC+5:30, SK wrote:
Reply all
Reply to author
Forward
0 new messages