I am having a difficult time finding the documentation that explains how to hook into javascript events that prepolutate custom fields added in the gform_advanced_settings hook.
add_action("gform_advanced_settings", "marketo_advanced_settings", 10, 2);
function marketo_advanced_settings($position, $form_id){
if($position == 100) {
?>
<li>
<label for="field_marketo_label">
<?php _e("Marketo Url", "gravityforms"); ?>
<?php
gform_tooltip("form_marketo_url")
?>
</label>
<input type="text" id="marketo_url" class="fieldwidth-3" size="35"/>
</li>
<?php
}
}
add_action("gform_editor_js", "editor_script");
function editor_script(){
?>
<script type='text/javascript'>
jQuery(document).bind("gform_load_field_settings", function(event, field, form) {
if (typeof field["marketo_url"] !== "undefined") {
jQuery("#marketo_url").attr("value", field["marketo_url"]);
} else {
jQuery("#marketo_url").attr("value", '');
}
});
</script>
<?php
}