There is a mitzvah to give charity before davening, but where I daven the gabbai brings around the pushka during ashrei/ uva t’zion goel, and earlier than that the pushka is not available. What should I do to be mekayem the halacha of giving prior to davening? Should I mentally have in mind that I am giving the money before davening, even though I am physically putting in the money only later?
The idea here is to do chesed before davening, like the posuk says ” v’ani btzedek echeze bonecha” (I will greet you with kindness) which is interpreted that I will greet H-shem after doing a chesed. (As a side point, in actuality you can fulfill this by doing any chesed before davening, such as helping someone in shul or by returning some seforim to their proper place) Regarding your question you can mentally decide to give the tzedakah beforehand and that would be considered doing a chesed before davening, however you should remember that it is a then neder l’tzedakah, and you must give it. Alternatively you can take money out ( (or merely think) that it is designated to give to the gabbai when he will come around, but it should be done with the intention that if for any reason it doesn’t work out that it isn’t yet given to tzedakah.
Baba Basra 10a, Rambam Matnos Aniyim 10-15, Mishna Berurah beginning of Siman 46, Halichos Shlomo 2 ftnt 27