You need to sign in to do that
Don't have an account?
mavs
issue in passing parameters to outputlink
hi
I want to pass the selected value of the radio as a parameter to OutputLink value. Below is the code
I selected 2008 and clicked on the Run Report Link, this is how the URL value is
When it should have been http://abc=2008/
Does anyone see issue with the code below? Please advise...
Thanks
<apex:page controller="output_test"> <apex:form > <apex:pageBlock > <apex:outputLabel value="Select Year" /> <apex:selectRadio value="{!year_num}" rendered="true"> <apex:selectOptions value="{!items}"/> </apex:selectRadio> <apex:outputlink target="_blank" value="http://abc={!year_num}">Run Report</apex:outputlink> </apex:pageBlock> </apex:form> </apex:page>
public class output_test { String year_num = null; public List<SelectOption> getItems() { List<SelectOption> options = new List<SelectOption>(); options.add(new SelectOption('2008','2008')); options.add(new SelectOption('2009','2009')); options.add(new SelectOption('2010','2010')); options.add(new SelectOption('2011','2011')); return options; } public String getYear_num() { return year_num; } public void setYear_num(String year_num) { this.year_num = year_num; } }
Ah I see, for this I think we're best off using a commandLink e.g.
All Answers
Please do modify the code as per the text highlighted in red below:-
<apex:pageBlock >
<apex:outputLabel value="Select Year" />
<apex:selectRadio value="{!year_num}" rendered="true">
<apex:selectOptions value="{!items}"/>
</apex:selectRadio>
<apex:outputlink target="_blank" value="page3&abc={!year_num}" >Run Report</apex:outputlink>
</apex:pageBlock>
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
HI - Still no luck
I changed the output link as mentioned , When clicked on the output link
This is what i got.
apex/page3&abc=
I am looking for selected radio value to appear
apex/page3&abc=2008
Please advise
Hey
You can try using the param tag
Cheers,
Wes
nope...it dint work either
I know this is simple, but not sure where i am doing wrong...
In that case your year_num variable must be empty. I just tested with that precise code and it works.
Wes
It is null initially
Thank you.
Putting initial value will pass what ever value was initialized. If another value is selected, it still passes the initial value.
I tried the above method as well..but no luck..:smileysad:
By the way
I did not get what you are saying (in red below) could you please eloborate?
Try giving it an initial value, or change the selectlist on your page before you push the button
Ah I see, for this I think we're best off using a commandLink e.g.
Thanks that worked...
small change
pr.getParameters().put('abc',year_num);