• Resolved mitys

    (@mitys)


    Hello, I am trying to populate my update form fields from a custom post type data.

    Bases on the plugin docuention, I used the Forminator_API::update_form_field( $form_id, $field_id, $data ); method like this:

    $data =array(

        'options' => Array
            (
                'label' => 'Prenom',
                'value' => 'this is the last name'
            ),
    
    
                'name' => 'text-1',
                'value' => 'this is the last name'
            );

    $fields = Forminator_API::update_form_field( 16049, ’email-1′, $data );

    And it did not work. This code only works for the email input type and the phone input.

    Any help please ?

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @mitys ,

    Can you share the whole code snippet so our developers can take a look and see what they can advise?
    Please use pastebin.com or a Dropbox like service to share code with us.

    kind regards,
    Kasia

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @mitys ,

    Please check this:

    $form_id = 1609;
        $field_id = 'text-1';
    
        $data = array(
    		'id' => 'text-1',
    		'element_id' => 'text-1',
    		'condition_action' => 'show',
    		'condition_rule' => 'any',
    		'conditions' => Array
    			(
    			),
    	
    		'type' => 'email',
    		'options' => Array
    			(
    			),
    	
    		'cols' => '12',
    		'validation' => '',
    		'placeholder' => 'Testing',
    		'field_label' => 'Enter Text',
    		'description' => '',
    		'validation_text' => '',
    		'custom-class' => '',
            'default' => 'testings'
    	);
    	
    	$fields = Forminator_API::update_form_field( $form_id, $field_id, $data );

    ‘default’ => ‘testings’ – default key is where you put custom value.

    kind regards,
    Kasia

    Thread Starter mitys

    (@mitys)

    Hello, thank you, the default key worked well for the text input type.

    I would like to do the same thing for the name input and the select input, how could I achieve that ?

    Thank you.

    Thread Starter mitys

    (@mitys)

    And for the address input too, thank you !

    Hi @mitys

    I pinged our SLS Team to review this and update the code. We will post an update here as soon as more information is available.

    Kind Regards,
    Kris

    Thread Starter mitys

    (@mitys)

    Hi, ok thank you,

    I will wait for that.

    Thread Starter mitys

    (@mitys)

    Hello, I cannot see the updates on the plugin documentation. Did you add any code ?

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @mitys,

    We would like to have a bit more information regarding the workflow you are looking to achieve.

    I would like to do the same thing for the name input and the select input, how could I achieve that ?

    If you are looking to display the default value on the front end, we would suggest achieving this through jQuery instead of modifying each field with the Forminator API.

    Could we know whether using jQuery would fit your requirements or not? So that we could suggest based on that?

    Hello, I cannot see the updates on the plugin documentation. Did you add any code ?

    Not sure I fully understood what you meant above. We can only provide and suggest code in this forums. Could you please explain further what you are referring?

    Looking forward to your response.

    Best Regards,

    Nithin

    Thread Starter mitys

    (@mitys)

    Hi,

    Actually I succeded to populate the text input(default) and also the select input (placeholder). What I am trying to do is to populate the form fields based on acf values before modifying them with the form.

    The only problem that persists now is the postdata title that I couldn’t display on the form with the update_form_field function..

    Plugin Support Williams – WPMU DEV Support

    (@wpmudevsupport3)

    Hi @mitys,

    Hope this message finds you well.

    The only problem that persists now is the postdata title that I couldn’t display on the form with the update_form_field function.

    That method is to update the field, as explained by Nithin, if you are trying to populate default values it can be done using jQuery instead of updating the post.

    However, if the post title is not populating, could you check if the meta value us correct?

    Best regards,
    Laura

    Plugin Support Laura – WPMU DEV Support

    (@wpmudev-support8)

    Hi @mitys

    We didn’t hear back from you for quite some time already so I’m marking this topic as resolved.

    If you still need assistance with this, just let us know.

    Kind regards,
    Adam

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Cannot update an input text field value with php’ is closed to new replies.