0

how i can knowing if the checkbox is checked or not on the form

function darksite_config_page() {
  $form['darksite_status'] = array(
    '#title' => t('Enable pop up screen'),
    '#description' => t('When enabled, a pop up screen will be displayed on the home page.'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('darksite_status', 0)
  );

  return system_settings_form($form);
}
  • check can be done in $form_state variable – subhojit777 Jan 22 '13 at 11:02
  • where are you trying to check it? – Mohammed Shameem Jan 22 '13 at 11:04
2

Like so:

if (variable_get('darksite_status', 0)) {
  // Yes.
}
else {
  // No.
}

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.