Skip to content

Instantly share code, notes, and snippets.

@ksnider
Last active May 19, 2017 07:37
Show Gist options
  • Save ksnider/cc099000965d715acb22 to your computer and use it in GitHub Desktop.
Save ksnider/cc099000965d715acb22 to your computer and use it in GitHub Desktop.
This script will allow you to make a field display on a web form but not be editable by users
/*
Instructions:
In the code below, replace the REPLACE WITH INFUSIONSOFT FIELD NAME with a # and the ID
of the field(s) you want to make read-only.
For example, if you were making the Email field read only, you would replace it with #inf_field_Email and the
code would look like this:
jQuery('#inf_field_Email').attr('readonly', true); // Be sure to leave single quotes in place
If you were making a custom field named TestField read only, you would replace it with #inf_custom_TestField and the
code would look like this:
jQuery('#inf_custom_TestFieldl').attr('readonly', true); // Be sure to leave single quotes in place
Modify the code below then copy and paste it into an HTML area on your webform.
*/
<script type="text/javascript">
$ = jQuery;
$(document).ready(function () {
jQuery('REPLACE WITH INFUSIONSOFT FIELD NAME').attr('readonly', true); // Makes the field read-only
});
</script>
@lizardking8610
Copy link

lizardking8610 commented May 19, 2017

Interesting. What are you using this code for? Obviously to make a field not editable, but what is the strategy behind that? I am guessing marketing but I can't quite figure out an application for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment