Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7766855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:31:43+00:00 2026-06-01T15:31:43+00:00

How do I save the status of checkboxes using the hook_submit? hook_form: $versionArray =

  • 0

How do I save the status of checkboxes using the hook_submit?

hook_form:

$versionArray = array('ver 1.7.0.0-beta1' => 'ver 1.7.0.0-beta1', 'ver 1.6.2.0' => 'ver 1.6.2.0', 'ver 1.5.1.0' => 'ver 1.5.1.0', 'ver 1.4.2.0' => 'ver 1.4.2.0', 'ver 1.3.3.0' => 'ver 1.3.3.0');

$form['mage']['version'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Select'),
    '#required' => TRUE,
    '#options' => $versionArray
);  

hook_submit:

....
$node->field_checkboxes[0]['value'] = $form_state['values']['mage']['version'];
....
node_save($node)

I have got all my other fields saving correctly, but these fields remain blank.

Thanks
Robert

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:31:44+00:00Added an answer on June 1, 2026 at 3:31 pm

    In your submit function try to use the following code

    $selected = array();
    foreach($form_state['values']['version'] as $a => $b)
    {
        if((string)$b != "0")
        {
             $selected[] = $b;
        }
    }
    variable_set("var_selected", $selected);
    

    Hope this helps… Muhammad.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ASP.NET MVC2 and I need to save user login status to indicate
<form> <input type=checkbox id=m_q name=m_q value=271>Name</input><div name=status></div> <input type=checkbox id=m_q name=m_q value=271>Age</input><div name=status></div> <input
i save in mysql database the time using NOW() function. how can i change
I save the form elements to a file and the following is working as
I want some return about dom manipulation. I think we can save elements' status
I have a relationship table with followed_id, follower_id, and status. I am using has
I want to extract data from HTML table using Python script and save it
I need some help with this, please ... If I save a transaction status
I'm trying to save data from HTML table to database using jquery to call
I need to trigger a signal if and only if form field status is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.