+ Start a Discussion

How to link my Inline VF page values with Custom Javascript Button


I would like to access field values via Javascript Button.When i'm trying to access the field values the values are not refreshing dynamically.Only the values that are there at the time of load are getting dispalyed.


This is my problem statement:


1) I have an inline VF Page with 2 radio buttons in the detail record.

2) I  have a custom Java Script Button in which i need to access the field values.

3) When I select one Radio button and click on that Button I need to access the selected value.

It's something like when I select 1 radio button and click on the button it should redirect to one URL

and when I select the other it should redirect to someother URL.


The problem lies in how to  link my Inline VF page values with Custom Javascript Button.


My Approach:

I created 2 check box fields and whenever I select one radiobutton, in the backend i'm updating the checkbox fields accordingly.

If I select Radiobutton1  it updates checkbox1 to true and If I select Radiobutton2 it updates checkbox2.

so now when I click on custom Javascript button and try to access those checkbox fields i'm getting their values as they are when the page loads.


The changed values of the checkbox fields cannot be accessed in the Custom button.The values that are there when the page loads are getting accessed.

So I'm unable to proceed further.


Is there anyway by which I can link my VF Page values to Custom Javascript button.


I need to use radio buttons only and there is no datatype as radio button so that is the reason I went for an Inline VF Page.

So if there anyother ways of getting a radio buttons pl suggest.


Any Help is highly appeciated :)

Many Thanks :)


You can do something like this in JS :

var myradios = document.getElementsByName('{!$Component.myRadio}');

for(i = 0; i < myradios.length; i++)
if(myradios[i].checked) {

alert('Selected value is: ' + myradios[i].value);