Variable does not exist in method

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












I am trying to pick up the value of a visual text input and validate if it exists in the database, the problem is that it throws me the following error "Variable does not exist: searchDir"



I leave my code (summarized):



Controller extension:



public class Direccion 

public string searchDirget; set;
public ApexPages.StandardController controller get; set;

public Direccion(ApexPages.StandardController controller)
this.controller = controller;


@RemoteAction
public static void verificarDireccion()
Account registros = [ SELECT FiscalAddress__c, BillingAddress__c, ShippingAddress__c
FROM Account
WHERE Account.FiscalAddress__c =: searchDir
OR Account.BillingAddress__c =: searchDir
OR Account.ShippingAddress__c =: searchDir
];
if(registros.size() > 0)

else






Visualforce:



<apex:page standardController="Account" extensions="Direccion" id="page">

<apex:inputText id="FiscalAdress" value="!searchDir"/>









share|improve this question







New contributor




Fabricio Nahuel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    up vote
    1
    down vote

    favorite












    I am trying to pick up the value of a visual text input and validate if it exists in the database, the problem is that it throws me the following error "Variable does not exist: searchDir"



    I leave my code (summarized):



    Controller extension:



    public class Direccion 

    public string searchDirget; set;
    public ApexPages.StandardController controller get; set;

    public Direccion(ApexPages.StandardController controller)
    this.controller = controller;


    @RemoteAction
    public static void verificarDireccion()
    Account registros = [ SELECT FiscalAddress__c, BillingAddress__c, ShippingAddress__c
    FROM Account
    WHERE Account.FiscalAddress__c =: searchDir
    OR Account.BillingAddress__c =: searchDir
    OR Account.ShippingAddress__c =: searchDir
    ];
    if(registros.size() > 0)

    else






    Visualforce:



    <apex:page standardController="Account" extensions="Direccion" id="page">

    <apex:inputText id="FiscalAdress" value="!searchDir"/>









    share|improve this question







    New contributor




    Fabricio Nahuel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I am trying to pick up the value of a visual text input and validate if it exists in the database, the problem is that it throws me the following error "Variable does not exist: searchDir"



      I leave my code (summarized):



      Controller extension:



      public class Direccion 

      public string searchDirget; set;
      public ApexPages.StandardController controller get; set;

      public Direccion(ApexPages.StandardController controller)
      this.controller = controller;


      @RemoteAction
      public static void verificarDireccion()
      Account registros = [ SELECT FiscalAddress__c, BillingAddress__c, ShippingAddress__c
      FROM Account
      WHERE Account.FiscalAddress__c =: searchDir
      OR Account.BillingAddress__c =: searchDir
      OR Account.ShippingAddress__c =: searchDir
      ];
      if(registros.size() > 0)

      else






      Visualforce:



      <apex:page standardController="Account" extensions="Direccion" id="page">

      <apex:inputText id="FiscalAdress" value="!searchDir"/>









      share|improve this question







      New contributor




      Fabricio Nahuel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I am trying to pick up the value of a visual text input and validate if it exists in the database, the problem is that it throws me the following error "Variable does not exist: searchDir"



      I leave my code (summarized):



      Controller extension:



      public class Direccion 

      public string searchDirget; set;
      public ApexPages.StandardController controller get; set;

      public Direccion(ApexPages.StandardController controller)
      this.controller = controller;


      @RemoteAction
      public static void verificarDireccion()
      Account registros = [ SELECT FiscalAddress__c, BillingAddress__c, ShippingAddress__c
      FROM Account
      WHERE Account.FiscalAddress__c =: searchDir
      OR Account.BillingAddress__c =: searchDir
      OR Account.ShippingAddress__c =: searchDir
      ];
      if(registros.size() > 0)

      else






      Visualforce:



      <apex:page standardController="Account" extensions="Direccion" id="page">

      <apex:inputText id="FiscalAdress" value="!searchDir"/>






      visualforce controller-extension remote-action






      share|improve this question







      New contributor




      Fabricio Nahuel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Fabricio Nahuel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Fabricio Nahuel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 hours ago









      Fabricio Nahuel

      61




      61




      New contributor




      Fabricio Nahuel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Fabricio Nahuel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Fabricio Nahuel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote













          searchDir is an instance variable. It is bound to a specific instance of the class Direccion - here, the controller extension.



          static methods, such as @RemoteAction JavaScript remoting actions, aren't bound to a specific instance and have no access to the instance variables of the Visualforce page's controller. As such, all state must be passed to the remote action as parameters.



          You need to modify the signature of your @RemoteAction method to



          public static void verificarDireccion(String searchDir) {


          and alter your Visualforce page's call to the method correspondingly, to pass the current value of this state variable directly to the method.






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "459"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );






            Fabricio Nahuel is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f232768%2fvariable-does-not-exist-in-method%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote













            searchDir is an instance variable. It is bound to a specific instance of the class Direccion - here, the controller extension.



            static methods, such as @RemoteAction JavaScript remoting actions, aren't bound to a specific instance and have no access to the instance variables of the Visualforce page's controller. As such, all state must be passed to the remote action as parameters.



            You need to modify the signature of your @RemoteAction method to



            public static void verificarDireccion(String searchDir) {


            and alter your Visualforce page's call to the method correspondingly, to pass the current value of this state variable directly to the method.






            share|improve this answer
























              up vote
              3
              down vote













              searchDir is an instance variable. It is bound to a specific instance of the class Direccion - here, the controller extension.



              static methods, such as @RemoteAction JavaScript remoting actions, aren't bound to a specific instance and have no access to the instance variables of the Visualforce page's controller. As such, all state must be passed to the remote action as parameters.



              You need to modify the signature of your @RemoteAction method to



              public static void verificarDireccion(String searchDir) {


              and alter your Visualforce page's call to the method correspondingly, to pass the current value of this state variable directly to the method.






              share|improve this answer






















                up vote
                3
                down vote










                up vote
                3
                down vote









                searchDir is an instance variable. It is bound to a specific instance of the class Direccion - here, the controller extension.



                static methods, such as @RemoteAction JavaScript remoting actions, aren't bound to a specific instance and have no access to the instance variables of the Visualforce page's controller. As such, all state must be passed to the remote action as parameters.



                You need to modify the signature of your @RemoteAction method to



                public static void verificarDireccion(String searchDir) {


                and alter your Visualforce page's call to the method correspondingly, to pass the current value of this state variable directly to the method.






                share|improve this answer












                searchDir is an instance variable. It is bound to a specific instance of the class Direccion - here, the controller extension.



                static methods, such as @RemoteAction JavaScript remoting actions, aren't bound to a specific instance and have no access to the instance variables of the Visualforce page's controller. As such, all state must be passed to the remote action as parameters.



                You need to modify the signature of your @RemoteAction method to



                public static void verificarDireccion(String searchDir) {


                and alter your Visualforce page's call to the method correspondingly, to pass the current value of this state variable directly to the method.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 2 hours ago









                David Reed

                20.1k21640




                20.1k21640




















                    Fabricio Nahuel is a new contributor. Be nice, and check out our Code of Conduct.









                     

                    draft saved


                    draft discarded


















                    Fabricio Nahuel is a new contributor. Be nice, and check out our Code of Conduct.












                    Fabricio Nahuel is a new contributor. Be nice, and check out our Code of Conduct.











                    Fabricio Nahuel is a new contributor. Be nice, and check out our Code of Conduct.













                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f232768%2fvariable-does-not-exist-in-method%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    What does second last employer means? [closed]

                    List of Gilmore Girls characters

                    One-line joke