XF 2.1 How do I stop browsers from auto-filling a field?

Jaxel

Well-known member
I've got a form field:
Code:
                    <xf:textboxrow class="host" name="page[page_options][host]" label="{{ phrase('host') }}"
                        value="{$page.page_options.host}" placeholder="127.0.0.1" />
                    <xf:textboxrow class="port" name="page[page_options][port]" label="{{ phrase('port') }}"
                        value="{$page.page_options.port}" placeholder="4444" />
                    <xf:passwordboxrow name="page[page_options][pass]" label="{{ phrase('password') }}"
                        value="{$page.page_options.pass}" placeholder="({{ phrase('optional') }})" />

All three fields are optional. So often they are left blank. The problem I am having is my browser keeps filling the fields out because it thinks it's a login form. It also asks me to save the password after I click submit. How can I stop this?

Fighting Games   Scoreboard Assistant.webp
 
That's correct for password fields. I'm not sure if ac="new-password" would work or not.
 
Okay, how about trying a hidden field before each real field.

HTML:
<input style="display:none" type="password" name="fakepasswordremembered"/>

Change type and name accordingly.
 
Another possibility:

JavaScript:
<script>
$(document).ready(function(){
$(':input').live('focus',function(){
$(this).attr('autocomplete', 'off');
});
});
</script>

Or this:

JavaScript:
<script>
$('form').attr('autocomplete','off');
</script>
 
Another possibility:

JavaScript:
<script>
$(document).ready(function(){
$(':input').live('focus',function(){
$(this).attr('autocomplete', 'off');
});
});
</script>

Or this:

JavaScript:
<script>
$('form').attr('autocomplete','off');
</script>
Again... modern browsers don't support autocomplete="off"
 
Top Bottom