Action Button on DV

This sub-forum is for discussing all topics related to AppGini Helper JavaScript Library, provided by bizzworxx as a third-party AppGini plugin.
Post Reply
angus
Veteran Member
Posts: 72
Joined: 2020-05-28 22:27

Action Button on DV

Post by angus » 2022-04-28 16:45

Hello everyone, I am creating a button on the DV, I want to link to another page.

this is what I have so far

Code: Select all

var actionbuttons = dv.actionbuttons;
var grp = actionbuttons .addGroup("Links", "globe")
var id = $j('#FD_ID').val();
console.log(id);
var href = "frontdoor_view.php?SelectedID=" + id;
grp.addLink("First Hub", href, Variation.primary, "align-left");
The issue I have is that this line here

Code: Select all

var id = $j('#FD_ID').val();
does not pick up the value (doesnt pick up any value actually.

Has anyone done this or knows how to do it that can help me?

thanks

Angus
AppGini 22.13

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1389
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Action Button on DV

Post by jsetzer » 2022-04-28 17:01

Please, first of all (1) remove the blank in line 2 and (2) add a ; at the end of line 2

Please (3) check if the field name really is all uppercase letters. Check if the field exists by dumping out $j('#FD_ID').length. should give 1.

(4) Just in case this is a lookup or any other more complex data type, .val() may not work. Try var id = dv.getField('FD_ID').getValue(); instead and check with console.log.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 291
Joined: 2018-03-04 09:30
Location: Orlando, FL

Re: Action Button on DV

Post by D Oliveira » 2022-04-28 18:15

just on top of what Jan said try to stick with either ' or " for quotes in your code, sometimes silly things like that can be the problem.

Best Regards,

angus
Veteran Member
Posts: 72
Joined: 2020-05-28 22:27

Re: Action Button on DV

Post by angus » 2022-04-29 17:39

jsetzer & D Oliveira thanks for your help

the issue was the missing ';' on line 2

I used your dv.getField('FD_ID').getValue(); also, this worked for me.

have a great weekend
AppGini 22.13

Post Reply