Javascript 在提交表单后单击“后退”按钮时,保留选中的复选框

Javascript 在提交表单后单击“后退”按钮时,保留选中的复选框,javascript,php,Javascript,Php,填写表单时,每当我点击“后退”按钮时,我输入的所有信息都会保留在字段中,复选框除外。 这是我使用php(drupal)为checkbox使用的代码 如果希望在客户端使用粘性表单,可以使用Javascript的。访问该链接并按照提供的示例进行操作。如果希望在客户端使用粘性表单,可以使用Javascript的。访问链接并按照提供的示例进行操作 $container =array('cartons' => t('Cartons'), 'glass_bo

填写表单时,每当我点击“后退”按钮时,我输入的所有信息都会保留在字段中,复选框除外。 这是我使用php(drupal)为checkbox使用的代码


如果希望在客户端使用粘性表单,可以使用Javascript的。访问该链接并按照提供的示例进行操作。

如果希望在客户端使用粘性表单,可以使用Javascript的。访问链接并按照提供的示例进行操作

  $container =array('cartons' => t('Cartons'),
                    'glass_bottle_jars' => t('Glass Bottles and Jars'),
                    'metal' => t('Metal Cans/Lids and/or Foil'),
                    'plastics' => t('Plastic Containers ≤ 5 Gallons'),
                    'not_sure' => t('Not Sure'));   
  $form['types_container'] = array(
     '#type' => 'checkboxes',
     '#title' => $this->t('Containers:'),
     '#size' => 1,
     '#validated' => TRUE,
     '#options' => $container,
  );