Page 1 of 1

Button with javascript

Posted: Wed Sep 12, 2012 11:24 am
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

Re: Button with javascript

Posted: Wed Sep 12, 2012 12:27 pm
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();
  });

}

Re: Button with javascript

Posted: Wed Sep 12, 2012 2:23 pm
by forgot
Thank you very much for such useful and quik answer!

Re: Button with javascript

Posted: Wed Sep 12, 2012 11:58 pm
by admin
.