- Messaggi: 12
- Ringraziamenti ricevuti 0
How can I easily maintain checkbox state?
- rperry
- Autore della discussione
- Offline
- Nuovo Utente
Less
Di più
12 Anni 10 Mesi fa #388
da rperry
How can I easily maintain checkbox state? è stato creato da rperry
How can I easily maintain checkbox state upon refresh?
Really need a clear how-to example on this. My site can be viewed here: HERE !
Really need a clear how-to example on this. My site can be viewed here: HERE !
Si prega Accesso o Crea un account a partecipare alla conversazione.
- andrea_4g
- Offline
- Amministratore
Less
Di più
- Messaggi: 1122
- Ringraziamenti ricevuti 163
12 Anni 10 Mesi fa - 12 Anni 10 Mesi fa #390
da andrea_4g
Risposta da andrea_4g al topic Re: How can I easily maintain checkbox state?
That isn't a standard version of Custom Properties, is it? (as far as I know there's no way to have the 'Select / Unselect All' checked by default).
Try without the js script you addedd (// All Region checkboxes checked by default
$("input[name='cp_region[]']").prop("checked", true); ...) and set the values you want in checked state as default.
Try without the js script you addedd (// All Region checkboxes checked by default
$("input[name='cp_region[]']").prop("checked", true); ...) and set the values you want in checked state as default.
Ultima Modifica 12 Anni 10 Mesi fa da andrea_4g.
Si prega Accesso o Crea un account a partecipare alla conversazione.
- rperry
- Autore della discussione
- Offline
- Nuovo Utente
Less
Di più
- Messaggi: 12
- Ringraziamenti ricevuti 0
12 Anni 10 Mesi fa #398
da rperry
Risposta da rperry al topic Re: How can I easily maintain checkbox state?
Yes, it is the standard version of Custom Properties, with a bit of custom JavaScript to get the functionality I'm looking for. I was able to create it select unselect all checkbox. what I'm looking for is the ability to maintain checkbox state upon page reload. This should be doable via cookies and JavaScript.
Concerning your recommendation below, I'm only allowed to select one checkbox as the default in the backend. I use JavaScript to select all checkboxes by default.
Concerning your recommendation below, I'm only allowed to select one checkbox as the default in the backend. I use JavaScript to select all checkboxes by default.
Si prega Accesso o Crea un account a partecipare alla conversazione.
- andrea_4g
- Offline
- Amministratore
Less
Di più
- Messaggi: 1122
- Ringraziamenti ricevuti 163
12 Anni 10 Mesi fa - 12 Anni 10 Mesi fa #399
da andrea_4g
Achieving the same results working only on the client side (js + cookie) is not easy / reliable at all. You need to store the state of each control before form submission, then retrieve that from the cookie when the page reloads, compare with checked boxes on new page, figure out if user has done any selections, decide if you need to restore the default state, ... to sum it up: you are entering in a world of pain
Risposta da andrea_4g al topic Re: How can I easily maintain checkbox state?
Nope, you *were* only allowed to select one checkbox as the default. Starting from version 2.0.6 *more* fields can be set as default.I'm only allowed to select one checkbox as the default
Achieving the same results working only on the client side (js + cookie) is not easy / reliable at all. You need to store the state of each control before form submission, then retrieve that from the cookie when the page reloads, compare with checked boxes on new page, figure out if user has done any selections, decide if you need to restore the default state, ... to sum it up: you are entering in a world of pain
Ultima Modifica 12 Anni 10 Mesi fa da andrea_4g.
Si prega Accesso o Crea un account a partecipare alla conversazione.
- rperry
- Autore della discussione
- Offline
- Nuovo Utente
Less
Di più
- Messaggi: 12
- Ringraziamenti ricevuti 0
12 Anni 10 Mesi fa #401
da rperry
Risposta da rperry al topic Re: How can I easily maintain checkbox state?
Sounds like a great challenge to me! I'll let you know when it's done.
Si prega Accesso o Crea un account a partecipare alla conversazione.
Tempo creazione pagina: 0.178 secondi