Jump to content

Auto-populating a form


Graham Quince

Recommended Posts

Forms and HTML widgets load into pages at different times, so while it might be possible to use an HTML widget to fill in a form, it was never advisable.... but I  had a bit of a brain wave, what if there was an auto-populate button?

<btn class="btn update">Update</btn>
<script>
var formUUID = "A177324620028A7AE4656F9A366E1506E020CAEC0FD54E71";
$(".update").click(function(){
  $('div[data-content-uuid="'+formUUID+'"]').find('#A1773C3F2003F19E97E1FF73A16D15075DA8D53C48F8AF59').val("Does this work");
});
</script>

This code targets the form, then the specific field.  You could add multiple fields within the function and have a big chunk of the form get filled out for you.  You could use a div superimposed above the form with the button on, so that users are forced to click it before they begin filling out the rest.  

There's a lot to unpack here, but as a hack/workaround I think its got potential.

  • Like 1
Link to comment
Share on other sites

22 hours ago, Graham Quince said:

Forms and HTML widgets load into pages at different times, so while it might be possible to use an HTML widget to fill in a form, it was never advisable.... but I  had a bit of a brain wave, what if there was an auto-populate button?


<btn class="btn update">Update</btn>
<script>
var formUUID = "A177324620028A7AE4656F9A366E1506E020CAEC0FD54E71";
$(".update").click(function(){
  $('div[data-content-uuid="'+formUUID+'"]').find('#A1773C3F2003F19E97E1FF73A16D15075DA8D53C48F8AF59').val("Does this work");
});
</script>

This code targets the form, then the specific field.  You could add multiple fields within the function and have a big chunk of the form get filled out for you.  You could use a div superimposed above the form with the button on, so that users are forced to click it before they begin filling out the rest.  

There's a lot to unpack here, but as a hack/workaround I think its got potential.

Obviously well above my understanding of code.....  but nice idea!! ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...