Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Cannot use object of type stdClass as array #27

Open
juxprose opened this issue May 24, 2015 · 7 comments
Open

Fatal error: Cannot use object of type stdClass as array #27

juxprose opened this issue May 24, 2015 · 7 comments

Comments

@juxprose
Copy link

I'm getting this error when embedding a form:

http://cl.ly/b3S8

@ArtemTimoshenko
Copy link

I have the same problem, have you solved it?

@juxprose
Copy link
Author

Nope I haven't solved this one. Would really appreciate any insights into this.

@tiborp
Copy link

tiborp commented Dec 15, 2015

It may help if you added the code used for embedding.

@c9dd
Copy link

c9dd commented Apr 26, 2016

I'm having the same issues. I used the code given in the documentation to try and get the form to display, and I used each method given.

I've also tried ...

`
$form_objects = get_sub_field( 'search_block_select_a_form' );

                foreach( $form_objects as $form_object )
                {
                  $form_object = get_object_vars($form_object);
                  $form_id     = $form_object['id'];
                  $form_title  = $form_object['title'];
                  $form_active = $form_object['is_active'];
                }

                //print_r($form_object);
                gravity_form_enqueue_scripts( $form_object['id'], true );
                gravity_form( $form_id, true, true, false, '', true, 1 );

`

and ...

`
$form_objects = get_sub_field( 'form' );

                foreach( $form_objects as $form_object )
                {
                  $form_id        = $form_object->id;
                  $form_title     = $form_object->title;
                  $form_active = $form_object->is_active;
                }
                gravity_form_enqueue_scripts( $form_id, true );
                gravity_form( $form_id, true, true, false, '', true, 1 );

`

@tiborp
Copy link

tiborp commented Apr 26, 2016

This is how I have it working:

$form = get_sub_field('your_form_field_id'); gravity_form_enqueue_scripts($form[0]['id'], true); gravity_form($form[0]['id'], false, false, false, '', true, 1);

@keygrip
Copy link

keygrip commented Apr 27, 2016

Change $form_object['id'] to $form_object->id.

$form_object = get_field('your_form_field_id'); echo do_shortcode('[gravityform id="' . $form_object->id . '" title="true" description="true" ajax="true"]');

or

$form_object = get_field('your_form_field_id'); gravity_form_enqueue_scripts($form_object->id, true); gravity_form($form_object->id, true, true, false, '', true, 1);

@mdnash
Copy link

mdnash commented Oct 24, 2016

Thanks keygrip, that fixes the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants