Hi, i’m trying to create a default address field by using the ‘gform_after_save_form’ hook. The problem is that the created address field is not editable in the form editor.
In the developer console of Chrome i get following message:
Uncaught TypeError: Cannot read property ‘customLabel’ of null
Any ideas what i’m doing wrong?
here is my code:
function add_default_fields( $form, $is_new ) {
if ( $is_new ) {
$form['fields'] = array(
array(
'type' => 'name',
'label' => 'Name',
'id' => 1,
'formId' => $form['id'],
),
array(
'type' => 'email',
'label' => 'Email',
'id' => 2,
'formId' => $form['id'],
),
array(
'type' => 'address',
'label' => 'Anschrift',
'id' => 3,
'formId' => $form['id'],
)
);
GFAPI::update_form( $form );
}
}