Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Button with javascript

Locked
forgot
Posts: 42
Joined: Thu Aug 09, 2012 8:52 pm

Button with javascript

Unread post by forgot »

Hello.

Is it possible added button in form that will run JavaScript on click and this button must behave in appearance like text field (I mean - integrate in form layout - Column Number - Order Number).

Now I use following technic
1. Use text field with style .readonly
2. In Default Value SQL place SELECT "Button name";
3. On On Double Click event place JavaScript function call - (like this - changeTimePeriod();).

Problem is this "button" don't work like button. I have to double click for event instead of single click.

Maxim
zazzium
Posts: 84
Joined: Mon Jul 04, 2011 12:52 am

Re: Button with javascript

Unread post by zazzium »

Maxim,

The easiest way is to use button type
Select Type Button (set button width on Button tab)
Title: Button name
On Double Click: changeTimePeriod()


if you do not want to make a button you can use jQuery
custom javascript:

Code: Select all

function nuLoadThis()
{
  $("#text_object_field_name").click(function(){
     //do stuff
      changeTimePeriod();
  });

}
forgot
Posts: 42
Joined: Thu Aug 09, 2012 8:52 pm

Re: Button with javascript

Unread post by forgot »

Thank you very much for such useful and quik answer!
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Button with javascript

Unread post by admin »

.
Locked