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
a contratora contrator 

Help!!!--can not get right content via <apex:param...value=... assignTo=...>

Hi,

In our application, the user must access the internal news / message.
As a simple test, I use <apex:param name="a"  value="news1,content"  assignTo="{!content}"/>  within <apex:commandLink>.  The problem is, the variable "content" can only get the value"news1".  In other word, if the string value contains a comma "," , all contents after comma will be ignored.  How to deal with it ?   Actually, the message is a long string including many commas and line breaks.  How can I get the whole content by using <apex:param name="a" value="{!each.Message__c} assignTo="{!content}"/>  and display it in a right way (including line breaks) ?

 

Thank you very much!

 

The test code:

<apex:page controller="testmsg">
 <apex:outputtext value="{!content}" style="color:red"/>
<br/>
<apex:form >
  <apex:commandlink action="{!dosomething}" value="test message box">
    <apex:param name="a" value="news1,content" assignTo="{!content}"/> 
  </apex:commandlink>
</apex:form>
</apex:page>

public class testmsg{

public string content{get;set;}
public void dosomething(){
//
}
}

SSRS2SSRS2

Sometime your requirement is not archived anyway you can get result  escape the comma by '&#44;' and setting outputtext escape is false.

<apex:page controller="testmsg">
 <apex:outputtext value="{!content}" style="color:red" escape="false"/>
<br/>
<apex:form >
  <apex:commandlink action="{!dosomething}" value="test message box">
    <apex:param name="a" value="news1&#44;content" assignTo="{!content}" /> 
  </apex:commandlink>
</apex:form>
</apex:page>

-Suresh

RollandRolland

Thanks Suresh.   Yeah, we can get the result by using '&#44;'.  The problem is we can not ask the user to input '&#44;' instead of ',' in the message box all the time.   I just have an idea--- try <apex:param name="a" value="{!each.Id}"  assignTo="{!content}"/>   In the controller, get content via Id (Id has no problem with comma).

Regards.

SSRS2SSRS2

Yes you can do that way it is secure and better.

Good luck friend

more info about param tag Incorrect use of apex:param tag??

 

-Suresh