Comments (6)
I've created a very basic example demonstrating this problem without ASP.NET. The html is in:
https://gist.github.com/4225453
I apologize if this is not the best way to send source.
With this example, I'm seeing two issues. It appears there are two different states maintained for the checkbox values. For example, when contracted, I can uncheck 1-5 and check 6-10 and, when expanded, I can uncheck 8-14 and check 1-7. If I flip back and forth between more/less, the state of the values also flips back and forth.
The second issue I'm seeing is what I described above. In the contracted state, if I uncheck 1-5 and hit submit, the form data sent shows 1-5 as checked.
It appears to be always submitting the values of the checkboxes in the expanded state. I was able to verify this with a few tests.
Am I using this wrong or should I not be using the expander with form elements? I appreciate any help! Thanks for your time in building and supporting these great tools!
Regards,
Brian
from jquery-expander.
Thanks for the report. I'm not sure, just by reading your description, why this would be happening, so I really appreciate the gist. It's kind of confusing since, once the plugin modifies the DOM when it's called, it doesn't do anything special with the contents of the details other than show and hide them. I'll look into it and get back to you as soon as I can.
from jquery-expander.
Hi Karl,
I have a home-grown expander on another similar page also just using
hide/show. I thought that behavior was really strange, especially
maintaining the state between the two. Please let me know if I can help
explain, test or do anything else.
Kind regards,
Brian
On Thu, Dec 6, 2012 at 11:07 AM, Karl Swedberg [email protected]:
Thanks for the report. I'm not sure, just by reading your description, why
this would be happening, so I really appreciate the gist. It's kind of
confusing since, once the plugin modifies the DOM when it's called, it
doesn't do anything special with the contents of the details other than
show and hide them. I'll look into it and get back to you as soon as I can.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/55#issuecomment-11096682.
from jquery-expander.
Thanks, Brian. I think I figured out what the problem is. When the plugin detects block-level elements that need to be split up, it takes the "safe route" and retains the entire contents for the "detail" as well as slicing up just enough for the "summary" and copying it into the summary div. This helps preserve the block formatting and avoids all sorts of brokenness. In your case, unfortunately, it means that you have two sets of the first 10 checkboxes. One thing you could do is bind a change handler to the checkboxes that changes the checked state of any other checkbox with the same name. Not terribly elegant, but it's working here: http://jsfiddle.net/kswedberg/YEwVu/
from jquery-expander.
Wow. Good catch, Karl. That's interesting.
I appreciate your suggested fix. I'll put that in and try it out. Since
I'm in ASP.NET and using autopostbacks with update panels, the autopostback
already binds a change handler to the checkbox. I'll give it a try and
test!
Thanks again!
Brian
On Thu, Dec 6, 2012 at 1:50 PM, Karl Swedberg [email protected]:
Thanks, Brian. I think I figured out what the problem is. When the plugin
detects block-level elements that need to be split up, it takes the "safe
route" and retains the entire contents for the "detail" as well as slicing
up just enough for the "summary" and copying it into the summary div. This
helps preserve the block formatting and avoids all sorts of brokenness. In
your case, unfortunately, it means that you have two sets of the first 10
checkboxes. One thing you could do is bind a change handler to the
checkboxes that changes the checked state of any other checkbox with the
same name. Not terribly elegant, but it's working here:
http://jsfiddle.net/kswedberg/YEwVu/—
Reply to this email directly or view it on GitHubhttps://github.com//issues/55#issuecomment-11103169.
from jquery-expander.
Closing due to inactivity.
from jquery-expander.
Related Issues (20)
- An option to start expanded would be useful HOT 4
- An event, like "expander.expanded" or "expander.contracted", after action (& animation) complete HOT 1
- Whitespace between span.read-more and span.details?
- preserveWord logic is flawed: strings of numbers are not preserved
- preserveWords: false not working HOT 4
- Publish to npmjs.org HOT 1
- OnSliced event HOT 1
- Expander inside iframe kills fancyBox keyboard navigation (prev/next via Arrow keys) HOT 3
- Issues with \n and white-space: pre-line; HOT 6
- Long url HOT 3
- A lot of <br> HOT 1
- position of collapse button HOT 1
- inline instead of inline-block HOT 1
- Space between spans creates space inside link HOT 2
- not working when i set data using ajax HOT 2
- Doesn't include aria-label as an option HOT 2
- Inaccurate slice for Chinese characters HOT 6
- Allow custom non-breaking elements
- Duplicate text when Normalizewhite space = false HOT 1
-  : texts are not working correctly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-expander.