0

I have webform and formbuilder modules installed.

In the file field settings form I want to add an extra checkbox field just like the required field but I am unable to do that.

I can add it to the webform_component_edit_form like the following

$form['validation']['check'] = array(
      '#type' => 'checkbox',
      '#title' => t('Check'),
      '#default_value' => ($component['check'] == '1' ? TRUE : FALSE),
      '#description' => t('Check this option if the user should be able to upload files.'),
      '#weight' => -1,
      '#parents' => array('check'),
    );

But it is not displaying in the formbuilder file settings edit form form_builder_field_configure.

Is there any way to add a field to form_builder_field_configure form and save with the node just like other fields?

  • Install File Entity module then create a field checkbox type like alt text. – rahulkumar.it Mar 28 at 7:17
0

you have to do it inside the form_id 'form_builder_field_configure'. Example :

hook_form_alter($form,$form_state,$form_id){
`switch($form_id){
     case 'form_builder_field_configure':
     // You put your code here
     $form['check'] = array(
       '#form_builder' => array(
         'property_group' => 'validation'
       ),
       '#type' => 'checkbox',
       '#title' => t('Check'),
       '#default_value' => '',
       '#description' => t('Check this option if the user should be able 
    to upload 
     files.'),
      '#weight' => -1,
);
  break;
 }

} `

I hope it'll help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.