Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

How to use button object to run javascript code?

Locked
FBC-Tim
Posts: 25
Joined: Thu Jun 23, 2011 6:08 am

How to use button object to run javascript code?

Unread post by FBC-Tim »

Problem:
I wanted to put a button on the body of the edit form that would run a JavaScript function I had defined in the "Javascript" tab for that form.
The button object has a place to put a form to launch, a Record ID, etc. but does not have a place for a straight JavaScript function call.
I wonder if it would be useful to add the ability for a button object to call a JavaScript function?

My Solution:
For now I have got around this by using a HTML Object and placing button code in it (see below). This is working well on screen but has the side effect of creating a 'hidden' phantom object that may make future maintenance harder for someone else.

Code: Select all

<input type="button" value="My Stuff" style="width:64px;" name="buttonMyStuff" id="buttonMyStuff" onclick="doMyStuff()" class="button">
I know I can use an 'Extra Action Button' to run JavaScript easily, but I wanted the button located down in the body of my edit form.
Is there a better way to solve this problem?
admin
Site Admin
Posts: 2825
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 30 times

Re: How to use button object to run javascript code?

Unread post by admin »

FBC-Tim,

Not very intuitive but, this is how you do it (you cant actually double click a button).

The explanation can be found here in the wiki http://wiki.nubuilder.com/tiki-index.ph ... uilderDocs

But try this..

Capture3.PNG
Hope that helps.

Steven
You do not have the required permissions to view the files attached to this post.
FBC-Tim
Posts: 25
Joined: Thu Jun 23, 2011 6:08 am

Re: How to use button object to run javascript code?

Unread post by FBC-Tim »

I missed that in the wiki, thanks for pointing it out.
Works well ;)
admin
Site Admin
Posts: 2825
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 30 times

Re: How to use button object to run javascript code?

Unread post by admin »

Cool!
Locked