function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sascha DeinertSascha Deinert 

Command Button set parameter

HI,

If I click on the button the parameter calc_view should set to value 1.
But the value is still 0.

Please help me.
 
<apex:commandButton value="CALC" onclick="window.open('/apex/calc_test','_blank','height=500,width=500,toolbar=no,scrollbars=no,resizeable=no,menubar=no,top=200,left=200'); return false;">
	<apex:param name="TEST" value="1" assignTo="{!calc_view}"/>
</apex:commandButton>
 
public class calc_class {

    public Integer calc_VIEW {get; set;}
    
    public Double value1 {get; set;}
    public Double value2 {get; set;}
    
    public calc_class() {
        calc_VIEW = 0;
    }
	
    
    public PageReference Pr_calc() {
        value2= value1/ 3.35 * 100;
        return new PageReference('/apex/calc_test');   
    }

}
Thanks,
Sascha
 
ManojjenaManojjena
HI Sascha,
What is your page name ,Is it the same page cals_test ? If so then problem is on click of button you are assigning 1 to the calc_VIEW . how ever on click of the button you are loading the page so your constructor is calling and assigning 0 to the variable .

 
Sascha DeinertSascha Deinert
Hi Manojjena,

these are different pages. The page with the button is CALC and the other CALC_Test.
How can I change the value of the variable from 0 to 1.

Thanks,
Sascha
ManojjenaManojjena
Hi Sascha ,

If posible paste your second page code as well .If it is very big then create a poc and post so that I will help you to fix .
Sascha DeinertSascha Deinert

Hi Manojjena,

here is the code of the second page for the calculation.
The value is just for the rendering.
 
<apex:page controller="calc_class" showheader="false" sidebar="false">

<apex:form >
    
<apex:outputPanel rendered="{!If(calc_VIEW=1,true,false)}">   

<apex:inputText value="{!value1}" maxlength="10" style="width:40px"/>

    <br/>
    
<apex:outputText value="{0, number, #,##0}"><apex:param value="{!value2}"/></apex:outputText>
    
    <br/>

<apex:commandbutton value="calc" action="{!Pr_calc}" />
    
    </apex:outputPanel>    
    
      
</apex:form>

</apex:page>
thanks,
Sascha
 
ManojjenaManojjena
Hi Sascha ,
In first page are you using the same controller ? If no if possible paste the first page code as well .Sorry for late response .