PHPackages                             webcito/bs-prompt - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. webcito/bs-prompt

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

webcito/bs-prompt
=================

description

v1.0.0(1mo ago)112↓88.9%proprietary

Since Jun 2Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/ThomasDev-de/bsPrompt)[ Packagist](https://packagist.org/packages/webcito/bs-prompt)[ RSS](/packages/webcito-bs-prompt/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

bsPrompt
========

[](#bsprompt)

`bsPrompt` is a jQuery plugin for Bootstrap 5 that replaces `window.prompt` with a Bootstrap modal dialog.

Installation
------------

[](#installation)

```

```

Usage
-----

[](#usage)

`$.bsPrompt()` is asynchronous because Bootstrap modals cannot block JavaScript execution like the native browser prompt. The returned jQuery Promise is the primary API for reading the result.

```
$.bsPrompt({
  title: 'Enter a name',
  message: 'What should the new item be called?',
  label: 'Name',
  type: 'text',
  required: true
}).then(function (value) {
  if (value === null) {
    return;
  }

  console.log(value);
});
```

Short form:

```
$.bsPrompt('Please enter a name', 'Default value').then(function (value) {
  console.log(value);
});
```

Handling Confirm
----------------

[](#handling-confirm)

Confirmed prompts resolve with the submitted string.

```
$.bsPrompt({
  title: 'Password',
  label: 'Password',
  type: 'password',
  required: true
}).then(function (value) {
  if (value === null) {
    return;
  }

  submitPassword(value);
});
```

Handling Cancel
---------------

[](#handling-cancel)

Cancelled prompts resolve with `null`.

```
$.bsPrompt({
  title: 'Delete item',
  message: 'Type the item name to continue.',
  required: true
}).then(function (value) {
  if (value === null) {
    console.log('The prompt was cancelled.');
    return;
  }

  deleteItem(value);
});
```

Optional Callbacks
------------------

[](#optional-callbacks)

Use `onConfirm` and `onCancel` only for side effects such as logging, analytics, or small UI updates. Do not use them as the main way to read the prompt result.

```
$.bsPrompt({
  title: 'Enter a name',
  required: true,
  onConfirm: function (value) {
    console.log('confirmed', value);
  },
  onCancel: function () {
    console.log('cancelled');
  }
}).then(function (value) {
  console.log('result', value);
});
```

Options
-------

[](#options)

OptionDefaultDescription`title``'Input required'`Modal title`message``''`Text above the input field`label``null`Input label`value``''`Initial value`type``'text'`Input type: `text`, `password`, `email`, `number`, `url`, `tel`, `date`, `time`, `textarea`, etc.`required``false`Prevents empty submissions`validate``null`Custom validation callback. Return `true`, `false`, or an error message string`invalidFeedback``'Please enter a value.'`Error message for empty values`okText``'OK'`OK button text`cancelText``'Cancel'`Cancel button text`onConfirm``null`Optional side-effect callback after a valid confirmation`onCancel``null`Optional side-effect callback after cancellation`attributes``{}`Additional HTML attributes, for example `{ maxlength: 80 }`Default Texts
-------------

[](#default-texts)

```
$.bsPrompt.setDefaults({
  title: 'Please provide input',
  okText: 'Continue',
  cancelText: 'Dismiss',
  invalidFeedback: 'This field is required.'
});
```

Replacing Native Prompt
-----------------------

[](#replacing-native-prompt)

`replaceNative()` overwrites `window.prompt`. After installing it, calls to `prompt()` open a Bootstrap modal instead of the browser's native blocking prompt.

```
$.bsPrompt.replaceNative({ required: true });

prompt('Name?', 'Max').then(function (value) {
  console.log(value);
});
```

This is intentionally not a drop-in replacement for synchronous code. Native browser prompts block JavaScript and return a string immediately; Bootstrap modals are asynchronous and return a jQuery Promise.

This native code cannot be preserved unchanged:

```
var value = prompt('Name?');
console.log(value);
```

Use the Promise result instead:

```
prompt('Name?').then(function (value) {
  if (value === null) {
    return;
  }

  console.log(value);
});
```

Restore the original browser prompt:

```
$.bsPrompt.restoreNative();
```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance90

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

52d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d5f10c16b4b6bd1ac531ffc39c23c569490ec4630829511692c03ec89d36a11?d=identicon)[thomasK81](/maintainers/thomasK81)

---

Top Contributors

[![ThomasDev-de](https://avatars.githubusercontent.com/u/67106837?v=4)](https://github.com/ThomasDev-de "ThomasDev-de (4 commits)")

---

Tags

bootstrapbootstrap-modalbootstrap5dialogfrontendjavascriptjqueryjquery-pluginmodalpromptuivalidation

### Embed Badge

![Health badge](/badges/webcito-bs-prompt/health.svg)

```
[![Health](https://phpackages.com/badges/webcito-bs-prompt/health.svg)](https://phpackages.com/packages/webcito-bs-prompt)
```

###  Alternatives

[jason-munro/cypht

Lightweight Open Source webmail written in PHP and JavaScript

1.6k157.9k](/packages/jason-munro-cypht)[symfony/symfony-demo

Symfony Demo Application

2.6k254.2k](/packages/symfony-symfony-demo)[mapbender/mapbender

Mapbender library

10418.3k8](/packages/mapbender-mapbender)[bacula-web/bacula-web

The open source web based reporting and monitoring tool for Bacula

1567.7k](/packages/bacula-web-bacula-web)[eveseat/web

SeAT Web Interface

2623.5k160](/packages/eveseat-web)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
