You are viewing limited content. For full access, please sign in.

Question

Question

Changing the Auto Fill button's text

asked on October 11, 2017

Hi everyone,

I am working on a form and I am trying to change the text of the "Auto Fill" button that currently reads "Auto Fill" which is very non-descriptive since I have 5 of those buttons.

A little backstory: My code used to work and then all of a sudden one day it didn't. It creates an error where the user can only see the "Submit" button and the title of the form, but as soon as I comment out the below code, the form works again but then I have those non-descriptive buttons again.

Is something wrong with my code? Example of how I am trying to rename the code:

document.getElementById("lookup1573").innerHTML = "Fill Section";

On button inspection, I see something a little odd:

<button id="lookup1573" class="autofill" type="button vo="d">Auto fill</button>

Upon further inspection is seems like the element doesn't even exist in DOM... Other forms that have the button renamed work fine. I have also tried copying the form and repairing it that way but it persistently doesn't work. My other option is recreating the form from scratch, which I don't really look forward to.

Any help would be much appreciated!

0 0

Replies

replied on October 11, 2017

Hey,

From memory the id of the lookup rules can change. If all you are trying to do it rename all autofill boxes there is a much easier way.

$('.autofill').html('Fill Section');

Hope it helps.

1 0
replied on October 12, 2017 Show version history

Thanks Aaron! Unfortunately that didn't seem to work - possibly because I have multiple Auto Fill buttons?

Here is the odd thing- your code works in Preview just not when you actually run the form. Same thing is happening with my code, it works perfectly in Preview but not when you actually run the form from its link. Odd!!

Can anyone suggest what the problem might be?

0 0
replied on October 12, 2017

Hmm thats weird. Im not at my computer to test if i can replicate the issue.

Just as a side note. In all of my projects i actualy hide this button as i find having to click it manualy to be a little painful. What i do is attach triggers to the fields involved in the lookup, the triggers then basicly click the hidden autofill button.

If this is something you would be interested in let me know and ill give you a code snippet.

1 0
replied on December 1, 2017

Aaron, would you mind sharing that code on the post?

0 0
replied on December 3, 2017
$(document).ready(function() {
  $('#q1 input,#q3 input').change(function() {
    $('.autofill').click();
  });
})

Change #q1/#q2 to the name of the field that you want to trigger the lookup. Keep in mind this will trigger all lookups in the form. You can target the .click call further in the selector if necessary.

2 0
You are not allowed to follow up in this post.

Sign in to reply to this post.