Page 1 of 1

Action Button on DV

Posted: 2022-04-28 16:45
by angus
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

Re: Action Button on DV

Posted: 2022-04-28 17:01
by jsetzer
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.

Re: Action Button on DV

Posted: 2022-04-28 18:15
by D Oliveira
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,

Re: Action Button on DV

Posted: 2022-04-29 17:39
by angus
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