confirm-dialog before submit

materix
Member | 66
+
0
-

Does Nette Forms contain any functionality for “confirmation before submit”? (e.g. "are you sure you want to delete?…)

materix
Member | 66
+
0
-

I can see there is a showModal-method: https://github.com/…etteForms.js#L309.

But that is maybe not meant to be initiated from outside the function? I must perhaps use an external js-library for building “confirm”-dialogs?

emololftw
Member | 81
+
+2
-

Hello materix,

im using native functions like:

<a
	class="dropdown-item dropdown-item-danger"
	onclick="return confirm({_confirmDelete.areYouSure})"
	n:href="delete! $group->id"
>
	{_module.technologies_group.delete}
</a>
m.brecher
Generous Backer | 735
+
+1
-

@materix I dont think this confirm-dialog in nette exists, I also in the past spent some time with solving this problem. I have also discussed on forum the purpose of showModal-method in nette forms javascript, the answer was that this method is for a few browsers, where modal is supported (Chrome not). It has nothing to do with delete confirm dialogue.

Iam also working on deleting confirmation dialog for forms and Iam planing tu encapsulate this confirmation as subcomponent of Control where is encapsulated also the form (one of possible ways how include form as component into presenter), but iam not finnished yet.

Or you can alternatively use easy vanilla javascript listening on the button – not the best way but works also.