amoffat / bootstrap-application-wizard

MIT License
1.86k stars 390 forks source link

Value attribute lost values for radio and hidden input when wizard close and reopen #71

Closed zhangxin511 closed 5 years ago

zhangxin511 commented 10 years ago

Before close, I have:

<input type="radio" name="DownLoad" id="DownLoad1" value="false" checked="">

Then close wizard by pressing the "X" on top right, and open it again by pressing button,it becomes:

<input type="radio" name="DownLoad" id="DownLoad1" value="" checked="">

for hidden, before:

<input type="hidden" name="RequestId" id="RequestId" value="666666">

after

<input type="hidden" name="RequestId" id="RequestId" value="">
zhangxin511 commented 10 years ago

OK, I figured out what is going on: In the demo.html, there is a piece of code that listen to reset event:

                wizard.on("reset", function() {
                    wizard.modal.find(':input').val('').removeAttr('disabled');
                    wizard.modal.find('.form-group').removeClass('has-error').removeClass('has-succes');
                    wizard.modal.find('#fqdn').data('is-valid', 0).data('lookup', 0);
                });

The line

wizard.modal.find(':input').val('')

will remove radio and hidden, because they are attribute of input. While the value of option of select element will survived.

Could we change the example in demo.html? I believe a lot of people like me know little about js will use the examples in demo.html directly or make changes on these examples while don't know what it exactly it is dong.