Last active
May 19, 2017 07:37
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.