nazmuslabs
Forum Replies Created
-
Forum: Plugins
In reply to: [Simple Address Autocomplete] Not Working for FormilatorGreetings!
Thanks for getting back to me! I am pleased to inform you that after the update, which already incorporates the code you asked me to modify above, now allows forminator form field to work correctly, Alhamdulillah (Praise God). Thank you so much for taking the time to address this.
Coffee’s on me; I’ll buy you a coffee as appreciation when I get some time to spare, Insha’Allah (God Willing)!
May Allah (S.W.T.) guide you and bestow upon you His blessings; Ameen.
Apologies for the late response! I have an update. Alhamdulillah I solved the issue through a workaround. Just an hour earlier, the original plugin developer also got back to me on modifying the plugin code to make it work. He notes he plans to eventually update his plugin with this modification, Insha’Allah (God Willing).
My workaround:
So, there is an ancient plug-in (which actually got delisted from the WP repository at the end of last year, for some guideline violation). I found this plugin from an old WPForms support video on YouTube. This plugin is similar to the one I was using, but it also gives you the option to use the “name”, or “class” of the field instead of the “ID”, if you so choose. This is useful because the “name” and “class” of the areas do not change.
Because the plugin was delisted, I manually went to the repo. I transferred all individual php and js files via FTP to manually install the plugin on my site, and it works, Alhamdulillah!
Now, obviously, it is not ideal that I am using a delisted plugin. So I will, Insha’Allah, go through the notes the developer just posted on modifying the JS file and see if I can use it.
Here are the relevant links:
The Delisted Plugin: Address Autocomplete Using Google Place Api – WordPress plugin | www.ads-software.com
Forum response thread from the address autocomplete plugin developer: Not Working for Formilator | www.ads-software.com
- This reply was modified 1 year, 9 months ago by nazmuslabs.
As promised, I have created a generic text field, calling it “Address”. Element inspector showed the field has the name “text-4”. So, after updating the code and running it, here are the results:
<input type="text" name="text-4" value="" placeholder="123 Rue Exemple" id="buki forminator-field-text-4_64590103f042e" class="forminator-input forminator-name--field" data-required="1">
Good news: the code did update the field ID, Alhamdulillah (Praise God)!
Bad news: it seems to have amended the custom ID value rather than replace it. So rather than just saying “buki” it now says “buki forminator-field-text-4_<random number>”.My guess is that Formintor is adding the id value after my code runs, thus amending it after the custom ID. Thoughts?
Thanks for the reply! I assumed the address field type was a text field type, as in the html source, it shows type=text. That is why I left the field as is. But now, I will replace the address field with a plain text field and try the code again and get back to you on what results I get, Insha’Allah (God Willing).
In the meantime, here’s the link to the plugin I am using: Autocomplete Google Address – WordPress plugin | www.ads-software.com
P.s., I definitely appreciate the time you have taken to answer my question. It gives me further confidence in this plugin, and if there were any form-building plugins we would pay for, it would be this one, as our business grows and we need to scale up to take advantage of the features.
May Allah (S.W.T.) guide and bestow upon you His blessings; Ameen.
- This reply was modified 1 year, 10 months ago by nazmuslabs.
Thank you for your reply. So I have done what you suggested, and pasted the code. Then after refreshing the page (after clearing all caches), I inspected the field, and the element is displayed as follows:
<input type="text" name="address-1-street_address" placeholder="E.g. 42 Wallaby Way" id="forminator-field-street_address-address-1_6451460daab35" class="forminator-input" data-required="1" aria-required="true" value="">
As you can see, the id is still “forminator-field-street_address-address-1_<random number>.
In order to verify that my site is reading the code correctly, I added this debug statement to the code.// debug statement error_log( 'forminator_css_id_text_field called with field ID: ' . $field['element_id'] );
In my error log file, it says this:
[02-May-2023 17:12:39 UTC] forminator_css_id_text_field called with field ID: text-3
One more thing:
I had replaced the// define custom CSS IDs for selected text fields $custom_ids = array( 'text-1' => 'my_street', 'text-2' => 'my_city', );
with
// define custom CSS IDs for selected text fields $custom_ids = array( 'address-1-street_address' => 'buki' );
because my field name is “address-1-street_address”. Perhaps I made a mistake here?
Thanks for your help.
Edit to answer your question, I am using a plugin to add the google places api. The plugin asks for the api key and field id.
May Allah (S.W.T.) guide and bless you.
- This reply was modified 1 year, 10 months ago by nazmuslabs.
- This reply was modified 1 year, 10 months ago by nazmuslabs.
- This reply was modified 1 year, 10 months ago by nazmuslabs.