Skip Navigation

[Resolved] Deactivate auto prompt in custom field of url

This thread is resolved. Here is a description of the problem and solution.

Problem:

Disable "autocomplete" of Toolset Forms inputs.

Solution:

It needs to add autocomplete="off" attribute into the HTML input box, for example:

https://toolset.com/forums/topic/deactivate-auto-prompt-in-custom-field-of-url/#post-1683473

Relevant Documentation:

https://www.w3schools.com/tags/att_input_autocomplete.asp

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 5 replies, has 2 voices.

Last updated by WeiS2074 1 month, 1 week ago.

Assigned support staff: Luo Yang.

Author
Posts
#1680539

Hi,

I have a custom field which field type is URL. Every time I start typing in this textbox it will show the previous URL I typed before. Can I deactivate this function?

#1681639

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

There isn't such kind of built-in feature within Toolset Types plugin, it is a feature of your browser, to order to disable it, it needs to add autocomplete="off" attribute into the HTML input box, for example:

<input name="q" type="text" autocomplete="off"/>

More help:
hidden link

So you will need to consider custom codes, for example, register a JS file in your website admin side:
https://developer.wordpress.org/reference/hooks/admin_enqueue_scripts/

In the JS file, setup custom JS codes to add the attribute: autocomplete="off"
hidden link

#1682401

I tried <p>[types field='cf-url' target='_blank' autocomplete="off" ][/types]</p>, it doesn't work.

does it have to be JS file? Is it any other option like create a code snippet?
to the JS file link you sent me, I don't find my answer from there. They do have a lot of examples, but I still don't know what to write into my script.

Can this solution apply to my question? https://toolset.com/forums/topic/autocomplete-off/ If yes, Is this the whole code to paste into the JS file?

#1683337

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Yes, it needs to use JS file to add HTML attribute autocomplete="off".

The solution you mentioned above is for CRED form, it won't work in your case.

Since it is a custom codes problem, if you need more assistance for it, please provide a test site, fill below private message box with login details, also point out:
1) The problem page/post URL
2) The custom URL field name
3) Where I can edit your PHP codes

#1683473

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Thanks for the detail, it is a Toolset post form, so you can setup the JS codes directly.

I have done below modifications in your website:
Edit the post form: Form New Unwraps
hidden link

Click "JS Editor", add below codes:

jQuery(document).on( 'cred_form_ready' , function () {
  jQuery( 'input[name="wpcf-cf-url"]' ).attr( 'autocomplete', 'off' );
});

Please test again, check if it is fixed, thanks

#1683781

Brilliant, now I know where to edit the JS file. Appreciated.