Godofbrowser / vuejs-dialog

A lightweight, promise based alert, prompt and confirm dialog
MIT License
351 stars 111 forks source link

add defaultdata to submitDialogForm #57

Closed fr-ser closed 5 years ago

fr-ser commented 5 years ago

Adding the content of prompt even for regular form submit outside clicks e.g. by clicking enter

The one-line change seems pretty obvious. I couldn't get the tests running on my machine otherwise I would have added a test.

Solves this bug: https://github.com/Godofbrowser/vuejs-dialog/issues/52

fr-ser commented 5 years ago

I also did not build and commit (only built locally to check if it works).

I seriously have no idea about the test and deploy process here :laughing:

Godofbrowser commented 5 years ago

Thanks @fr-ser 🙌

Godofbrowser commented 5 years ago

Also... Tests were broken for long, they should run now.

jochemmeyers commented 4 years ago

It looks like the fix never made it into the dist folder in version 1.4.1.

src/plugin/js/mixins/dialog-mixin.js contains the adjusted line in the submitDialogForm function:

submitDialogForm () {
    this.okBtnDisabled || this.proceed(this.getDefaultData())
},

but dist/vuejs-dialog-mixin.min.js contains this:

submitDialogForm:function(){this.okBtnDisabled||this.proceed()},
nhsome commented 4 years ago

Thanks for @jochemmeyers @Godofbrowser, please update minified files and npm package.

https://github.com/Godofbrowser/vuejs-dialog/pull/71

decpk commented 4 years ago

This doesn't work even now in v1.4.1. How can we fix this issue? I mean if I don't enter any string in input and hit enter then it returns an empty string, that's fine but as soon as I enter some text and hit enter then it returns an object with data property as null.

Godofbrowser commented 4 years ago

Looking into this.

Godofbrowser commented 4 years ago

Updated

decpk commented 4 years ago

constantly looking when it will get updated on npm bcz current project needs submitDialogForm.

Godofbrowser commented 4 years ago

@and-ocean2017 package has been updated on npm. Please let me know if new version resolves the issue so i can close #52

decpk commented 4 years ago

yeah @Godofbrowser it resolves the null issue 👍, but I think it would be more convenient to show some kind of error if data property is an empty string (i.e if the user hit enter as soon as prompt shows without inserting data). There should be a kind of option maybe showEmptyError just to check if the user inserted data and hit enter then we are good to go else if data is an empty string then show error without closing the dialog box. So that user can inset data again. we are manually checking here. There must be some OOB feature

try {
        const dialog = await this.$dialog.prompt({ title, promptHelp });
        if (dialog.data.length > 0) {
          // CONTAIN DATA
        } else {
         // DOESN'T CONTAIN DATA
      }