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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:35:19+00:00 2026-06-09T14:35:19+00:00

I have a hidden form field that stores the values of a jQuery UI

  • 0

I have a hidden form field that stores the values of a jQuery UI sortable list.

<input name="asw_options[asw_icon_order]" type="hidden" value="<?php echo $aswicons ?>" />

I have a jQuery function that saves the order of the sorted list.

/* Social Networking Icon Sorter */
var itemList = $('#asw-sortable');

itemList.sortable({
    update: function(event, ui) {
        $('#loading-animation').show(); // Show the animate loading gif while waiting

        opts = {
            url: ajaxurl, // ajaxurl is defined by WordPress and points to /wp-admin/admin-ajax.php
            type: 'POST',
            async: true,
            cache: false,
            dataType: 'json',
            data:{
                action: 'item_sort', // Tell WordPress how to handle this ajax request
                order: itemList.sortable('toArray').toString() // Passes ID's of list items in  1,3,2 format

            },
            success: function(response) {
                $('#loading-animation').hide(); // Hide the loading animation
                //$('#asw_options[asw_icon_order]').val(itemList.sortable('toArray').toString()); // Update hidden field with new values
                $('input[name=asw_options[asw_icon_order]]').val(itemList.sortable('toArray').toString());
                return; 
            },
            error: function(xhr,textStatus,e) {  // This can be expanded to provide more information
                alert(e);
                // alert('There was an error saving the updates');
                $('#loading-animation').hide(); // Hide the loading animation
                return; 
            }
        };
        $.ajax(opts);
    }
}); 

The data stored gets saved like this:

Delicious,Twitter,Facebook,Googleplus,Stumbleupon,Pinterest,LinkedIn,Youtube

All is working well. You reorder the fields and the save happens automatically through jQuery.

My issue is that the hidden field that is stored above, I need to be able to update that dynamically through jQuery after jQuery has successfully done the new save of the order.

This is a WordPress plugin, so I need the hidden input field updated because if a user hits the “Save” button, it saves the older values because that is what the initial “Value” of the hidden field is.

As you can see in the jQuery code I thought I could add the code to the “Success” function and then update the hidden field then, however it doesn’t work.

Any help would be greatly appreciated.

  • 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-09T14:35:20+00:00Added an answer on June 9, 2026 at 2:35 pm

    You are missing some quotes in your selector, try this:

    $('input[name="asw_options[asw_icon_order]"]').val(itemList.sortable('toArray').toString());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this form: <tr> <td><input type=hidden name=ledlamps value=LED lamps>LED lamps:</td> <td><input class=field checkbox
I have a hidden input field in my form. I noticed that if that
I have an hidden input field with a value, <form> <input type=hidden value=product/> <select
I have a form with a hidden Came from Adwords field that will be
I have a field in a CCK node form that is hidden, and has
I have a third party control that utilizes a single hidden input field to
So I have this hidden form and this 'I like this' button that I
I have a hidden button on a form that I need to click in
I have a contact form that can be hidden using .slideToggle() but I want
I have multiple hidden form fields which store values about the the current view

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.