-
Is it possible to add a check/uncheck all to a checkbox group?
Posted 1 year ago # -
Hello, is there anybody here?
Is it possible to add a "check/uncheck all" to a checkbox group?Posted 1 year ago # -
Hi,
Sorry for delay, I was busy a little.
There is no option for that, but I have coded something about that right now. Let's test it. Download edited version:
[removed]then try these parameters in checkbox config array:
array( 'id' => 'my-checkbox', 'type' => 'checkbox', 'title' => 'Checkbox', 'check_all' => true, // <--- New parameter. // 'check_all_text' => 'Check/Uncheck All', // <--- New parameter and it is optional. 'options' => array( 'opt-1' => 'Option 1', 'opt-2' => 'Option 2', 'opt-3' => 'Option 3', ), ),
CopyCopied!and give me feedback
Regards, Codestar
Posted 1 year ago # -
Hello,
Thank you for looking to add this.
I installed the new codestar-framework folder and added the new parameter 'check_all' => true, to my config.
This is in the Profile Option Framework
// Create a section CSF::createSection( $prefix, array( 'fields' => array( array ( 'id' => 'loc-allowed', 'type' => 'checkbox', 'title' => 'Allowed Access', 'check_all' => true, // <--- New parameter. '100' => ACME MAIN', '101' => 'ACME Juan Tabo', '102' => 'Albuquerque Metal Recycling', '103' => 'Ace Metals', '104' => 'ACME Bosque Farms', '105' => 'ACME Roswell', '106' => 'Rio Rancho Recycling', ), ) ) );
CopyCopied!
It added the "Check/Uncheck All" text string to the bottom of the checkbox group but they are not clickable. I hard refreshed several times to make sure the js was refreshed and even visited the file directly to make sure it was loading the correct "/* Codestar Framework | A Simple and Lightweight WordPress Option Framework - v2.2.8.x*/" version.Another issue is that codestar will not allow me to individually uncheck each checkbox and save, it always leaves the last one checked, so "uncheck all" and saving might not work.
Posted 1 year ago # -
Hi,
Uh, I didn't understand why it not works in your side
Take a look video:
Also there is not correct styles, interesting. Check your browser console log. maybe any error ?
Regards, Codestar
Posted 1 year ago # -
Hello,
Here is a video from the live site.
It shows the console log on the right with no errors.
https://www.screencast.com/t/Brxgi1ghkw6s
It shows that the "check/uncheck" all ore not clickable
It also shows how you cannot remove all values, when you try it will leave the checked (and I assume in the database)
Please let me know your thoughts.
Thanks,
RussPosted 1 year ago # -
Hi,
Oh is it live site ? Give me the admin information if possible. I can check it quickly and find where is the issue.
Regards, Codestar
Posted 1 year ago # -
You know what I realized is that I have another plugin that uses codestar framework on this project. I updated that plugin to also use the version 2.2.8.x and now the "check/uncheck all" works. :-) Thank you for adding this feature, now there is still one more issue.
What doesn't work is being able to save after unchecking all options either manually or using the check/uncheck all.
If you have 3 checked and click the uncheck all and save, those 3 will remain checked when the page reloads after hitting save.
In other words codestar framework will not let you remove all the checks when saving.Please let me know if this can be fixed. Did you want me to open a new topic?
Thanks,
RussPosted 1 year ago # -
Hi,
Oh yes, I was think same. there can be a conflict. hmm no we can continue in this topic.
I did try what you mean and it works as expected. Do you have another scenario ?
Regards, Codestar
Posted 1 year ago # -
Thanks,
I see it works in your video in the "Admin Options Framework" but please try it in the "Profile Option Framework" which is where I am having the problem with unchecking all and saving.
Let me know what you find out.
Thanks,
RussPosted 1 year ago # -
Hi,
Actually, I had try it on "Profile Options" as well. Take a look:
btw, be sure field id must be unique. it can not be same with another field.
Regards, Codestar
Posted 1 year ago # -
I see, can I have "Admin Options Framework" and "Profile Option Framework" in the same settings.php file?
<ul> <li><label><input type="checkbox" name="acme_dash_profile[loc-allowed][]" value="100" data-depend-id="loc-allowed"><span class="csf--text">ACME Main</span></label></li> <li><label><input type="checkbox" name="acme_dash_profile[loc-allowed][]" value="101" data-depend-id="loc-allowed"><span class="csf--text">ACME Juan Tabo</span></label></li> <li><label><input type="checkbox" name="acme_dash_profile[loc-allowed][]" value="102" data-depend-id="loc-allowed"><span class="csf--text">Albuquerque Metal Recycling</span></label></li> <li><label><input type="checkbox" name="acme_dash_profile[loc-allowed][]" value="103" data-depend-id="loc-allowed"><span class="csf--text">Ace Metals</span></label></li> <li><label><input type="checkbox" name="acme_dash_profile[loc-allowed][]" value="104" data-depend-id="loc-allowed"><span class="csf--text">ACME Bosque Farms</span></label></li> <li><label><input type="checkbox" name="acme_dash_profile[loc-allowed][]" value="105" data-depend-id="loc-allowed"><span class="csf--text">ACME Roswell</span></label></li> <li><label><input type="checkbox" name="acme_dash_profile[loc-allowed][]" value="106" data-depend-id="loc-allowed" checked=""><span class="csf--text">Rio Rancho Recycling</span></label></li> </ul>
CopyCopied!The output looks like the above in the HTML, loc-allowed is unique as well as the prefix acme_dash_profile.
Where does it store the result? In the wp_usermeta table? I can't find the acme_dash_profile key anywhere.Posted 1 year ago # -
Hi,
Yes, you can have both in the same settings.php file.
HTML output looks normal. and yes it store in wp_usermeta table.
Hey btw, I added an example in DEMO, click to link and go to profile page: http://codestarthemes.com/plugins/codestar-framework/wp-login.php?login=demo
Just added like this:
array( 'id' => 'my-checkbox', 'type' => 'checkbox', 'title' => 'Checkbox with check/uncheck all', 'check_all' => true, 'options' => array( 'opt-1' => 'Option 1', 'opt-2' => 'Option 2', 'opt-3' => 'Option 3', ), ),
CopyCopied!Regards, Codestar
Posted 1 year ago # -
OK, I figured out what is the problem.
I have data_type set to unserialize.CSF::createProfileOptions( $prefix, array( 'data_type' => 'unserialize', // The type of the database save options. `serialize` or `unserialize` ) );
CopyCopied!I changed it to serialize and it will remove them all when unchecked and saved, but it will not remove them all when the data_type is set to unserialize.
Can you fix that?
I can rewrite my code to support the serialized array but would prefer to use it with unserialize and it should probably be fixed anyways.
I hope that helps.
Thanks,
RussPosted 1 year ago # -
Hi,
Uh, are you sure? I did set as unserialize it works still... you can test on demo again.
http://codestarthemes.com/plugins/codestar-framework/wp-login.php?login=demo
Please can you try on a clean wordpress.
Regards, Codestar
Posted 1 year ago # -
Hi again,
Yes, I'm sure, but now I think I know why even more.In your demo site try just having the Checkbox group with no other options and data_type set to unserialize.
On my site, when I added a text box then it worked, when I removed the textbox and just have the checkbox group it did not work.
Please try only the checkbox group with no other options and let me know if that's it.
Thanks,
RussPosted 1 year ago # -
Hi,
Oh finally, I have facing the issue. Yes, I hadn't try to save only one checkbox group field. It's a bug and fixed.
Let's try this:
DownloadRegards, Codestar
Posted 1 year ago # -
This is working great!
I appreciate the support and you hanging in there with me.
Until next time. Take care man!
RussPosted 1 year ago # -
Hi,
You're welcome always. we did fix a bug together, I get happy.
Have a nice day. take care you too.
Regards, Codestar
Posted 1 year ago #