You need to sign in to do that
Don't have an account?
lavanya gottumukkala
passing value from inputText field to action method in commandLink
Hi All,
We have below code.
<apex:inputText id="advsearchfield" title="Go!" maxlength="80" size="18"/>
<apex:commandLink value="GO" id="btn" target="_parent" action="/search/SearchResults?searchType=2&search=Search&sen=0&str=" />
User will enter input into input text field and I want to pass that input into the action method below with out using controller.
Anybody has any idea?
Thanks in advance
We have below code.
<apex:inputText id="advsearchfield" title="Go!" maxlength="80" size="18"/>
<apex:commandLink value="GO" id="btn" target="_parent" action="/search/SearchResults?searchType=2&search=Search&sen=0&str=" />
User will enter input into input text field and I want to pass that input into the action method below with out using controller.
Anybody has any idea?
Thanks in advance
bob_buzzard
You'll need to use JavaScript for this - add an onclick handler to the commandlink that extracts the contents of the inputtext and appends this to the action. In fact you don't even need to use Visualforce tags for this, vanilla HTML will work just as well and remove a form thus cutting down on the viewstate size.
lavanya gottumukkala
Thanks for your update.
search
using above code we are able to get the value in onclick handler,but how to pass this value to query string(
/search/SearchResults?searchType=2&search=Search&sen=0&str=)
bob_buzzard
Access the target for the anchor tag and append the value to it. There's an example of this at: http://stackoverflow.com/questions/3998496/change-the-href-of-an-anchor-tag-with-javascript