materialize icon indicating copy to clipboard operation
materialize copied to clipboard

about modal

Open simpliw opened this issue 10 years ago • 8 comments

i clear the value of the input in the modal before i close modal. when i reopen the modal, the input is not the initial state. It seems to get the focus. how can i deal with it to make it look like a new modal?

simpliw avatar Aug 26 '16 09:08 simpliw

wechatimg71

simpliw avatar Aug 26 '16 09:08 simpliw

@simpliw any code snippets ?

iqbalaqaba avatar Aug 27 '16 06:08 iqbalaqaba

@iqbalaqaba
Can you understand that I am describing Well?

simpliw avatar Aug 27 '16 15:08 simpliw

Code snippets help us debug the situation for you. While a screenshot is helpful, it is almost impossible to tell you what the problem is

acburst avatar Aug 27 '16 17:08 acburst

I have a simple javascript form reset on the click of the close button:

<script> function resetForm(formID, msgs) { document.getElementById(formID).reset(); document.getElementById(msgs).innerHTML =''; }</script>

<div class="modal-footer"><a class="modal-action modal-close btn-flat" onclick='resetForm("contact_form", "contact-form-messages");'>Close</a></div>

It does the trick

jenwebb avatar Aug 28 '16 00:08 jenwebb

@iqbalaqaba @acburst export default { data() { return { temp: { content: '', name: '' } }; }, computed: {}, ready() { $('.modal-trigger').leanModal(); }, attached() {}, methods: { notify: function() { if (this.temp.content.trim() && this.temp.name.trim()) { this.$dispatch('child-msg', this.temp) this.temp.content = ''; this.temp.name = ''; } } }, components: {} };

simpliw avatar Aug 29 '16 01:08 simpliw

@jndoy I tried it your way. the label on top is not located inside the input

simpliw avatar Aug 29 '16 01:08 simpliw

@simpliw I didn't include the code for the form itself in my example. I just attached a function to the close button of the modal that the form is inside. I have several modal forms on one page, so the function takes the form ID and the ID of it's corresponding error output element as parameters.

jenwebb avatar Aug 30 '16 00:08 jenwebb