VF Page:

<apex:form id="fm">
      <apex:actionFunction name="searchbox"  action="{!searchbox}"  rerender="pb">
       <apex:param name="x" value="" assignTo="{!IsEmailValue}" />  


    function conRec () {
        //  alert('conRec');
        var pattern = /^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/;
        var SearchVal = document.getElementById('pg:fm:pb:SearchValue').value;
        var IsEmailValue;
            IsEmailValue =SearchVal;
            IsEmailValue ='';


    <apex:slds />
    <apex:pageBlock id="pb" >

        <div class="slds-scope slds-box">
            <apex:outputPanel >                   
                <div id="formBlock">

                    <div id="showErrorMsgbuserName">
                        <div class="slds-form-element">
                            <div class="slds-align_absolute-center">
                                <!--- <apex:input value="{!searchBoxstring}"  id="SearchID" styleClass="searchBox"/>  --->

                                <apex:input value="{!searchBoxstring}" styleClass="searchBox" id="SearchValue" />
                                &nbsp;  &nbsp;  &nbsp; 
                               <!--- <apex:commandButton value="Search" onClick="conRec()" />--->
                                  <input type="button" value="Search" onClick="conRec()" class="slds-button slds-button-brand"/>


                <apex:pageMessages id="Error" escape="false" />

                <apex:dataTable value="{!result}" var="con" border="1" cellpadding="5" cellspacing="4" bgcolor="lightblue">
                    <apex:column value="{!con.Name}" styleClass="controls">
                        <apex:facet name="header">Name</apex:facet>
                    <apex:column value="{!con.Email}" styleClass="controls">
                        <apex:facet name="header">Email</apex:facet>
                    <apex:column value="{!con.Phone}" styleClass="controls">
                        <apex:facet name="header">Phone</apex:facet>




public class SearchPageController {

public string searchboxstring{get; set;}
public string IsEmailValue {get; set;}

public String Email{get;set;}

public list<contact> result {get; set;}

public SearchPageController()
    result = new list<Contact>();

public void  searchbox(){

    system.debug('IsEmailValue-->' + IsEmailValue);         


I was trying to Print IsEmailValue value but it's empty. Please help us on this.

  • Are you getting the value in JS? – rahul gawale Sep 10 '19 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.