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 760997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:47:07+00:00 2026-05-14T15:47:07+00:00

I have a from with a checkbox, and depending on the checkbox state 2

  • 0

I have a from with a checkbox, and depending on the checkbox state 2 different divs are shown.

            var alias = document.getElementById('alias');
            var list = document.getElementById('list');
            if(document.getElementById('isList').checked)
            {
                alias.style.display = 'none';
                list.style.display = 'table-row';

            } else {
                alias.style.display = 'table-row';
                list.style.display = 'none';
            }

Here is the HTML/PHP (relevant) part:

<tr id="alias" style="display:table-row;">
      <td>' . form_label('Destination:', 'destination') . '</td>
      <td>' . form_textarea('destination') . '</td>
</tr>
<tr  id="list" style="display:none;">
     <td>' . form_label('File Path:', 'list_path') . '</td>
     <td>' . form_input('list_path') . '</td>
</tr>

alias div is shown by default on page load, list shown then i click on isList checkbox, and alias is shown again when i click on the checkbox again.
This part works great and pretty straight froward.

Now, I add CodeIgniter Form Validation plugin, set appropriate rules and set-up validation plugin to re-populate the form with.

Without checkbox enabled everything works great. On errors form is re-populated.

However, when form is submitted with checkbox enabled, I have an issue.
CI’s Form Validation plugin re-populates the form, and re-enables the checkbox,
but the list div that is supposed to be shown when checkbox enabled is not there,
and instead the alias div is shown.

Is there any way around this issue? Can i have the list div shown on list validation error?

Also, i would like to avoid using JavaScript form validation, and stick with my good old PHP.

Thank you in advance.
-i

  • 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-05-14T15:47:07+00:00Added an answer on May 14, 2026 at 3:47 pm

    Ha… I just fixed it with a simple

    <body onload="showHide();">

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

Sidebar

Related Questions

I have a checkbox list which is filled with entries from my database on
I have a multi-select checkbox. Depending on which one is checked, I want to
I have from time to time heard mention of a mailing list or lists
Hi i have a checkbox and in code behind i insert the value from
I have a list of checkboxes and i have a select_all checkbox. Please check
i have data in database with value from checkbox i try to set checkbox
I have (from the sed website http://sed.sourceforge.net/sed1line.txt ) this one-liner: sed -e '/./{H;$!d;}' -e
Here's the code I have: from cStringIO import StringIO from lxml import etree xml
Normally, when using mock, I'll have from mock import Mock m = Mock() m
i have a from with a submit button after using jquery the page will

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.