1

I'm trying to pass parameters while using immediate=true. (actionRegion is not an option)

Since this won't work:

    <apex:inputText value="{!searchValue}" />
    <apex:commandButton value="Search" action="{!doSearch}" immediate="true"/>

I tried to create a variable and use it like this:

1: <apex:variable var="input" value="" />
2: <apex:inputText value="{!input}"/>
3: <apex:commandButton value="Search" action="{!doSearch}" immediate="true">
4:      <apex:param name="value" assignTo="{!searchValue}" value="{!input}" />
5: </apex:commandButton>

But in line 2 it tells me

Save error: Unknown property 'input'

Any idea if there is a way to define this variable with any kind of user input?

Last option would be some hacky JS like: onblur="setApexVar()" any experience with this?

1 Answer 1

2

you can try something like

    <apex:variable var="input" value="" />
     <apex:inputText value="{!input}" styleclass="textCls"/>
     <apex:commandButton value="Search" onclick="passValue()" rerender="none"/>
      <apex:actionfunction action="{!doSearch}" immediate="true" />
          <apex:param name="value" assignTo="{!searchValue}"/>
     </apex:actionfunction>

<script>
   function passValue()
   {
        var val= document.getElementsByClassName('textCls')[0].value;
       actfun(val);

    }
<script>

Using this actionfunction you can pass value to controller.

Update: I am not sure about actionfunction but you can remove one script method.

     <apex:inputText styleclass="textCls"/>
     <apex:commandButton value="Search" onclick="actfun(document.getElementsByClassName('textCls')[0].value);" rerender="none"/>
      <apex:actionfunction action="{!doSearch}" immediate="true" />
          <apex:param name="value" assignTo="{!searchValue}"/>
     </apex:actionfunction>
5
  • I had the same Idea, but it's too hacky for me, since it is using a Button, an Actionfunction and another function, just to pass one string, so I was hoping to find a more native solution
    – itsmebasti
    Commented May 19, 2016 at 8:51
  • Tushar.. Have you ever used tooltip help text in vf for salesforce1 ? I am just looking for a solution have you used ever like that something?
    – Ratan Paul
    Commented May 19, 2016 at 10:14
  • @Ratan no I didn't. But if you can give me some details then I can suggest you any option :) Commented May 19, 2016 at 13:34
  • 1
    @TusharSharma Thanks for your concern. I solved the issue. I just guessing may be your worked on something. Thanks anyways. :)
    – Ratan Paul
    Commented May 19, 2016 at 13:49
  • Ratan, can you post a new question about the tool tips?
    – Matt Lacey
    Commented May 20, 2016 at 0:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .