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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:49:49+00:00 2026-05-25T22:49:49+00:00

I have set up a workspace area which represents a blank PDF page where

  • 0

I have set up a workspace area which represents a blank PDF page where users can select paper size using radio buttons, orientation of landscape or portrait using radio buttons and personal motivation and goal statements using checkboxes. The user checks / unchecks the statement(s) they would like to place on the workspace and are also able to drag and drop them.

When a user changes the orientation I need all the checked statement items to be briefly saved, which I am putting into an array. Then uncheck all the checkboxes of the statements that were chosen to be added (this works) and remove all the statements from the workspace (this does not work). I need to then loop through the array to go back and check the checkboxes (this works) and call the BoardElement function (this does not work) to run the ajax call.

The related code I am using is below, and have tried many suggestion from different posts. The OrientationChange function is what I am using to attempt the save, remove and call to BoardElement which gets the elements.

Thanks.

HTML

            <h3>Paper Size</h3>
            <input type="radio" name="paper_size" id="paper_size1" value="8-5x11" checked="checked" />            
            8.5&quot;x11&quot;
            &nbsp; <input type="radio" name="paper_size" id="paper_size2" value="11x17" />            
            11&quot;x17&quot;

        </fieldset>

        <fieldset>

            <h3>Orientation</h3>
                <input type="radio" name="orientation" id="orientation1" value="l" checked="checked" /> Landscape
                &nbsp; <input type="radio" name="orientation" id="orientation2" value="p" /> Portrait

        </fieldset>

        <fieldset>

            <h3>Elements</h3>
                <input type="checkbox" name="board_element_cb" id="board_ele_0" value="0" /> "Who Am I" Image&nbsp; 
                <input type="checkbox" name="board_element_cb" id="board_ele_1" value="1" /> "Who Am I" Text&nbsp; 
                <input type="checkbox" name="board_element_cb" id="board_ele_2" value="2" /> Mission Statement&nbsp; 
        </fieldset>

jQuery

$(document).ready
(
function ()
{
BoardElement = function ()
{
    var elements_array = new Array('wai_img_', 'wai_text_', 'mission_text_', 'affirmation_text_', 'gratitude_text_', 'role_model_');
    if ($(this).is(':checked'))
    {
        var data_string = 'board_element=' + $(this).val();
        $.ajax
        ({
            type: 'POST',
            url: 'get_board_element_ajax.php',
            data: data_string,
            success: function(html)
            {
                $('#board_area').append(html);
                $('.draggable_item').draggable
                ({
                    containment: '#board_area',
                    stack: '#board_area div'
                });
            }
        });
    }
    else
    {
        var checked_value = $(this).val();
        $('.draggable_item').each
        (
        function ()
        {
            if (this.id.indexOf(elements_array[checked_value]) > -1)
            {
                $('#' + this.id).remove();
            }
        });
    }
}
$('input[id^=board_ele_]').click(BoardElement);


// save, remove and get selected board items on orientation change
OrientationChange = function ()
{
    var board_ele_array = new Array();
    // save
    $('input[id^=board_ele_]').each
    (
    function (i)
    {
        if ($('#board_ele_' + i).is(':checked'))
        {
            $('#board_ele_' + i).attr('checked', false);
            board_ele_array.push(i);
            $('#board_ele_' + i).attr('checked', false);
        }
    });
    //for (var j = 0; j < board_ele_array.length; j++)
    //{
    var j = 0;
    function BoardEleCheckbox ()
    {
        if (j < board_ele_array.length)
        {
            $('#board_ele_' + board_ele_array[j]).attr('checked', true);
            //$('#board_ele_' + board_ele_array[j]).click();
            //BoardElement();
            $('#board_ele_' + board_ele_array[j]).click(BoardElement);
            j++;
            setTimeout(BoardEleCheckbox, 1000);
        }
    }
    setTimeout(BoardEleCheckbox, 1000);
    //}
}
$('input[name=orientation]').click(OrientationChange);

});
  • 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-25T22:49:50+00:00Added an answer on May 25, 2026 at 10:49 pm

    Have you tried:

    $('#board_ele_' + i).removeAttr('checked');
    BoardElement.call($('#board_ele_' + i).get(0));
    board_ele_array.push(i);
    

    and then:

    $('#board_ele_' + board_ele_array[j]).attr('checked', 'checked');
    BoardElement.call($('#board_ele_' + board_ele_array[j]).get(0));
    j++;
    setTimeout(BoardEleCheckbox, 1000);
    

    Once a handler is assigned to the element, you invoke it with a no-args call, hence click().

    Edit: http://jsfiddle.net/uxqWv/3/

    Edit 2: http://jsfiddle.net/uxqWv/7/

    When you click on the checkbox, first the state changes and then the handler gets fired. It seems though that when you invoke a click handler through jQuery it’s the other way around. So the handler thinks that you just checked the button, and adds another board element. To work around this you have to call the handler on the checkbox manually with call method of the javascript Function object.

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

Sidebar

Related Questions

We have set up a SharePoint meeting workspace (using WSS 3.0) for our weekly
I made this small Java program using eclipse IDE. I have set the workspace
I have set up the Workspace and have got all folders and can open
I have set up a version control system using TortoiseSVN at my home to
I have set of scripts for doing scripted installs. You can use the scripts
I have 3 projects in a VS6 workspace. One is the main program, which
I have my web page set up right. I am just starting to build
I have a project which I have copied from my old workspace to a
I have written a nice plugin, which incoporates some generated java sources. I can
I have an Eclipse workspace set up on one of my two work machines.

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.