指用于向用户显示重要信息的图形对话框。这些对话框显示在所有其他内容之上,阻止应用程序流,直到收到用户输入。
在我的项目页面上,我在卡片中显示项目,当您单击卡片时,会弹出一个模式,其中包含有关该项目的详细信息。这与“服务”页面相同。一切正常
在我的应用程序(适用于 iOS,使用 iPhone 14 Plus 进行测试)中,我有一个页面想要显示为模式。目前的问题是,当我将其显示为模式时,内容没有填充整个...
我想在运行我的页面时动态创建一个 jquery 对话框模式,但我无法获得它模式,我得到一个无模式对话框 这是我的简单代码 函数 show()...</desc> <question vote="0"> <p>我想在运行我的页面时动态创建一个jquery对话框模式,但我无法得到它<strong>modal</strong>,我得到一个无模式对话框</p> <p>这是我的简单代码</p> <pre><code> <script> function show() { var dialog = $('<div id="msg_dialog"></div>').dialog(); dialog.dialog({ modal: true, autoOpen: true, title: 'Test', buttons: [ { text: 'Ok', click: function() { $('#res').empty().append('<h1>Open<h1>'); $('#msg_dialog').remove(); } }, { text: 'Cancel', click: function() { $('#res').empty().append('<h1>Close<h1>'); $('#msg_dialog').remove(); } } ] }); } </script> </code></pre> </question> <answer tick="false" vote="0"> <p><strong>加载模态加载</strong> 确保在加载时运行该函数。 试试这个代码: 将 <pre><code><body></code></pre> 替换为 </p> <pre><code><body onload="show();"> </code></pre> <p>或者你可以添加这一行</p> <pre><code>window.onload = function(){show();}; </code></pre> <p><strong>简单的模态代码可帮助您纠正代码</strong></p> <pre><code>$("#dialog-message").dialog({ modal: true, draggable: false, resizable: false, position: ['center', 'top'], show: 'blind', hide: 'blind', width: 400, dialogClass: 'ui-dialog-osx', buttons: { "I've read and understand this": function() { $(this).dialog("close"); } } }); </code></pre> <p>来源:<a href="http://jsfiddle.net/db5SX/" rel="nofollow">http://jsfiddle.net/db5SX/</a></p> </answer> </body></html>
当我在另一个模态之上打开一个模态时,为什么我的离子背景 + 模态阴影样式不起作用? 前言:这在 V4 上运行良好,但在升级到 V5 时出现问题。我不想变...
我想使用prototype和scriptaculous制作一个模态窗口。我想知道是否有任何网站有教程,或者是否有人可以给我一些想法从哪里开始。 (我不...
所以,我正在尝试在 React 中制作一个模态。我将模态与触发并渲染它以显示自身的元素分离到另一个文件中。模式打开,但由于某种原因,当我尝试...
Discord Modal 更新后不更新 TextInput 标签 (Python)
过去几天我一直在学习如何编写机器人并有了大概的想法,但现在我遇到了这个问题: 类 FormButtons(discord.ui.View): def __init__(自身): 超级()。
启用csrf时,在codeigniter4中从模态提交表单时出现303错误
我有一个 codeignter4 Web 应用程序,具有以下视图,其中有一个提交数据的模式。 函数删除确认(网址){ $('#btn-delete').attr('href', url); ...</desc> <question vote="1"> <p>我有一个 codeignter4 Web 应用程序,具有以下视图,其中有一个提交数据的模式。</p> <pre><code><script> function deleteConfirm(url){ $('#btn-delete').attr('href', url); $('#deleteModal').modal(); } </script> <!-- Begin Page Content --> <div class="container-fluid"> <!-- Page Heading --> <h1 class="h3 mb-4 text-gray-800"><?= esc($title); ?></h1> <div class="col-lg-7"> <?php if(session()->getFlashdata('message')):?> <?= session()->getFlashdata('message') ?> <?php endif; unset($_SESSION['message']); ?> </div> <div class="card col-lg-7 shadow mb-4"> <div class="card-header py-3"> <h6 class="m-0 font-weight-bold text-primary"><a href="" data-toggle="modal" data-target="#newRoleModal"><i class="fas fa-plus"></i> Add New</a></h6> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered table-hover table-striped" id="dataTable" width="100%" cellspacing="0"> <!--<thead class="thead-dark">--> <thead class="bg-warning"> <tr> <th>#</th> <th>Authority</th> <th>Action</th> </tr> </thead> <tbody> <?php $index = 1; ?> <?php foreach($role as $r) : ?> <tr> <td><?= esc($index); ?></td> <td><?= esc($r['role']); ?></td> <td> <a class="badge badge-primary" style="font-size:14px;" href="<?= site_url('admin/roleaccess/'.$r['id']); ?>">Manage Access</a> <a class="badge badge-success" style="font-size:14px;" href="<?= site_url('admin/editrole/'.$r['id']); ?>">Update</a> <a class="badge badge-danger" style="font-size:14px;" href="#!" onclick="deleteConfirm('<?= site_url('admin/deleterole/'.$r['id']); ?>')">Delete</a> </td> </tr> <?php $index++; ?> <?php endforeach; ?> </tbody> </table> </div> </div> </div> </div> <!-- /.container-fluid --> </div> <!-- End of Main Content --> <!-- Modal add new role--> <div class="modal fade" id="newRoleModal" tabindex="-1" role="dialog" aria-labelledby="newRoleModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="newRoleModalLabel">Add New Authority</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <!-- form --> <?php $attributes = array('id' => 'myform'); ?> <?= form_open('admin/addrole'); ?> <div class="modal-body"> <div class="form-group"> <input type="text" class="form-control" id="role" name="role" placeholder="Name of Authority"> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> <button type="submit" class="btn btn-success">Add</button> </div> <? = form_close(); ?> </div> </div> </div> <!-- modal delete --> <div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Are you sure?</h5> <button class="close" type="button" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body">Deleted data cannot be recovered!!</div> <div class="modal-footer"> <button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button> <a id="btn-delete" class="btn btn-danger" href="#">Remove</a> </div> </div> </div> </div> </code></pre> <p>启用 csrf 时,表单提交会重定向到视图本身。当我检查 Web 控制台“网络”选项卡时,它在 addrole 上显示 303 状态,这是处理表单提交数据的控制器方法。然而,当 csrf 被禁用时它工作正常。我怎样才能让它工作</p> <p>我的过滤器类</p> <pre><code><?php namespace Config; use CodeIgniter\Config\BaseConfig; use CodeIgniter\Filters\CSRF; use CodeIgniter\Filters\DebugToolbar; use CodeIgniter\Filters\Honeypot; use CodeIgniter\Filters\InvalidChars; use CodeIgniter\Filters\SecureHeaders; class Filters extends BaseConfig { /** * Configures aliases for Filter classes to * make reading things nicer and simpler. * * @var array */ public $aliases = [ 'csrf' => CSRF::class, 'toolbar' => DebugToolbar::class, 'honeypot' => Honeypot::class, 'invalidchars' => InvalidChars::class, 'secureheaders' => SecureHeaders::class, 'auth' => \App\Filters\Auth::class, ]; /** * List of filter aliases that are always * applied before and after every request. * * @var array */ /*public $globals = [ 'before' => [ // 'honeypot', 'csrf', // 'invalidchars', ], 'after' => [ //'toolbar', // 'honeypot', // 'secureheaders', ], ];*/ public $globals = [ 'before' => [ //'honeypot', 'csrf', //'isLoggedIn' => ['except' => ['/', 'admin','users', 'dashboard', 'logout','auth','Ticket/getStatusCounts']], //'isGranted' => ['except' => ['/', 'admin', 'users','dashboard', 'logout','auth', 'blocked', 'home', 'Welcome/*','Registration/*','profile','profile_save','profile_edit','Ticket/getStatusCounts']], ], 'after' => [ 'toolbar', // 'honeypot', ], ]; /** * List of filter aliases that works on a * particular HTTP method (GET, POST, etc.). * * Example: * 'post' => ['foo', 'bar'] * * If you use this, you should disable auto-routing because auto-routing * permits any HTTP method to access a controller. Accessing the controller * with a method you don’t expect could bypass the filter. * * @var array */ public $methods = []; /** * List of filter aliases that should run on any * before or after URI patterns. * * Example: * 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']] * * @var array */ public $filters = []; } </code></pre> <p>我的配置/应用程序文件</p> <pre><code><?php namespace Config; use CodeIgniter\Config\BaseConfig; use CodeIgniter\Session\Handlers\FileHandler; class App extends BaseConfig { /** * -------------------------------------------------------------------------- * Base Site URL * -------------------------------------------------------------------------- * * URL to your CodeIgniter root. Typically this will be your base URL, * WITH a trailing slash: * * http://example.com/ * * If this is not set then CodeIgniter will try guess the protocol, domain * and path to your installation. However, you should always configure this * explicitly and never rely on auto-guessing, especially in production * environments. * * @var string */ public $baseURL = 'http://localhost/demo/public'; /** * -------------------------------------------------------------------------- * Index File * -------------------------------------------------------------------------- * * Typically this will be your index.php file, unless you've renamed it to * something else. If you are using mod_rewrite to remove the page set this * variable so that it is blank. * * @var string */ public $indexPage = 'index.php'; /** * -------------------------------------------------------------------------- * URI PROTOCOL * -------------------------------------------------------------------------- * * This item determines which getServer global should be used to retrieve the * URI string. The default setting of 'REQUEST_URI' works for most servers. * If your links do not seem to work, try one of the other delicious flavors: * * 'REQUEST_URI' Uses $_SERVER['REQUEST_URI'] * 'QUERY_STRING' Uses $_SERVER['QUERY_STRING'] * 'PATH_INFO' Uses $_SERVER['PATH_INFO'] * * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded! * * @var string */ public $uriProtocol = 'REQUEST_URI'; /** * -------------------------------------------------------------------------- * Default Locale * -------------------------------------------------------------------------- * * The Locale roughly represents the language and location that your visitor * is viewing the site from. It affects the language strings and other * strings (like currency markers, numbers, etc), that your program * should run under for this request. * * @var string */ public $defaultLocale = 'en'; /** * -------------------------------------------------------------------------- * Negotiate Locale * -------------------------------------------------------------------------- * * If true, the current Request object will automatically determine the * language to use based on the value of the Accept-Language header. * * If false, no automatic detection will be performed. * * @var bool */ public $negotiateLocale = false; /** * -------------------------------------------------------------------------- * Supported Locales * -------------------------------------------------------------------------- * * If $negotiateLocale is true, this array lists the locales supported * by the application in descending order of priority. If no match is * found, the first locale will be used. * * @var string[] */ public $supportedLocales = ['en']; /** * -------------------------------------------------------------------------- * Application Timezone * -------------------------------------------------------------------------- * * The default timezone that will be used in your application to display * dates with the date helper, and can be retrieved through app_timezone() * * @var string */ public $appTimezone = 'Asia/Kolkata'; /** * -------------------------------------------------------------------------- * Default Character Set * -------------------------------------------------------------------------- * * This determines which character set is used by default in various methods * that require a character set to be provided. * * @see http://php.net/htmlspecialchars for a list of supported charsets. * * @var string */ public $charset = 'UTF-8'; /** * -------------------------------------------------------------------------- * URI PROTOCOL * -------------------------------------------------------------------------- * * If true, this will force every request made to this application to be * made via a secure connection (HTTPS). If the incoming request is not * secure, the user will be redirected to a secure version of the page * and the HTTP Strict Transport Security header will be set. * * @var bool */ public $forceGlobalSecureRequests = false; /** * -------------------------------------------------------------------------- * Session Driver * -------------------------------------------------------------------------- * * The session storage driver to use: * - `CodeIgniter\Session\Handlers\FileHandler` * - `CodeIgniter\Session\Handlers\DatabaseHandler` * - `CodeIgniter\Session\Handlers\MemcachedHandler` * - `CodeIgniter\Session\Handlers\RedisHandler` * * @var string */ public $sessionDriver = FileHandler::class; /** * -------------------------------------------------------------------------- * Session Cookie Name * -------------------------------------------------------------------------- * * The session cookie name, must contain only [0-9a-z_-] characters * * @var string */ public $sessionCookieName = 'ci_session'; /** * -------------------------------------------------------------------------- * Session Expiration * -------------------------------------------------------------------------- * * The number of SECONDS you want the session to last. * Setting to 0 (zero) means expire when the browser is closed. * * @var int */ public $sessionExpiration = 7200; /** * -------------------------------------------------------------------------- * Session Save Path * -------------------------------------------------------------------------- * * The location to save sessions to and is driver dependent. * * For the 'files' driver, it's a path to a writable directory. * WARNING: Only absolute paths are supported! * * For the 'database' driver, it's a table name. * Please read up the manual for the format with other session drivers. * * IMPORTANT: You are REQUIRED to set a valid save path! * * @var string */ public $sessionSavePath = WRITEPATH . 'session'; /** * -------------------------------------------------------------------------- * Session Match IP * -------------------------------------------------------------------------- * * Whether to match the user's IP address when reading the session data. * * WARNING: If you're using the database driver, don't forget to update * your session table's PRIMARY KEY when changing this setting. * * @var bool */ public $sessionMatchIP = false; /** * -------------------------------------------------------------------------- * Session Time to Update * -------------------------------------------------------------------------- * * How many seconds between CI regenerating the session ID. * * @var int */ public $sessionTimeToUpdate = 300; /** * -------------------------------------------------------------------------- * Session Regenerate Destroy * -------------------------------------------------------------------------- * * Whether to destroy session data associated with the old session ID * when auto-regenerating the session ID. When set to FALSE, the data * will be later deleted by the garbage collector. * * @var bool */ public $sessionRegenerateDestroy = false; /** * -------------------------------------------------------------------------- * Cookie Prefix * -------------------------------------------------------------------------- * * Set a cookie name prefix if you need to avoid collisions. * * @var string * * @deprecated use Config\Cookie::$prefix property instead. */ public $cookiePrefix = ''; /** * -------------------------------------------------------------------------- * Cookie Domain * -------------------------------------------------------------------------- * * Set to `.your-domain.com` for site-wide cookies. * * @var string * * @deprecated use Config\Cookie::$domain property instead. */ public $cookieDomain = ''; /** * -------------------------------------------------------------------------- * Cookie Path * -------------------------------------------------------------------------- * * Typically will be a forward slash. * * @var string * * @deprecated use Config\Cookie::$path property instead. */ public $cookiePath = '/'; /** * -------------------------------------------------------------------------- * Cookie Secure * -------------------------------------------------------------------------- * * Cookie will only be set if a secure HTTPS connection exists. * * @var bool * * @deprecated use Config\Cookie::$secure property instead. */ public $cookieSecure = false; /** * -------------------------------------------------------------------------- * Cookie HttpOnly * -------------------------------------------------------------------------- * * Cookie will only be accessible via HTTP(S) (no JavaScript). * * @var bool * * @deprecated use Config\Cookie::$httponly property instead. */ public $cookieHTTPOnly = true; /** * -------------------------------------------------------------------------- * Cookie SameSite * -------------------------------------------------------------------------- * * Configure cookie SameSite setting. Allowed values are: * - None * - Lax * - Strict * - '' * * Alternatively, you can use the constant names: * - `Cookie::SAMESITE_NONE` * - `Cookie::SAMESITE_LAX` * - `Cookie::SAMESITE_STRICT` * * Defaults to `Lax` for compatibility with modern browsers. Setting `''` * (empty string) means default SameSite attribute set by browsers (`Lax`) * will be set on cookies. If set to `None`, `$cookieSecure` must also be set. * * @var string|null * * @deprecated use Config\Cookie::$samesite property instead. */ public $cookieSameSite = 'Lax'; /** * -------------------------------------------------------------------------- * Reverse Proxy IPs * -------------------------------------------------------------------------- * * If your server is behind a reverse proxy, you must whitelist the proxy * IP addresses from which CodeIgniter should trust headers such as * HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify * the visitor's IP address. * * You can use both an array or a comma-separated list of proxy addresses, * as well as specifying whole subnets. Here are a few examples: * * Comma-separated: '10.0.1.200,192.168.5.0/24' * Array: ['10.0.1.200', '192.168.5.0/24'] * * @var string|string[] */ public $proxyIPs = ''; /** * -------------------------------------------------------------------------- * CSRF Token Name * -------------------------------------------------------------------------- * * The token name. * * @deprecated Use `Config\Security` $tokenName property instead of using this property. * * @var string */ public $CSRFTokenName = 'csrf_test_name'; /** * -------------------------------------------------------------------------- * CSRF Header Name * -------------------------------------------------------------------------- * * The header name. * * @deprecated Use `Config\Security` $headerName property instead of using this property. * * @var string */ public $CSRFHeaderName = 'X-CSRF-TOKEN'; /** * -------------------------------------------------------------------------- * CSRF Cookie Name * -------------------------------------------------------------------------- * * The cookie name. * * @deprecated Use `Config\Security` $cookieName property instead of using this property. * * @var string */ public $CSRFCookieName = 'csrf_cookie_name'; /** * -------------------------------------------------------------------------- * CSRF Expire * -------------------------------------------------------------------------- * * The number in seconds the token should expire. * * @deprecated Use `Config\Security` $expire property instead of using this property. * * @var int */ public $CSRFExpire = 7200; /** * -------------------------------------------------------------------------- * CSRF Regenerate * -------------------------------------------------------------------------- * * Regenerate token on every submission? * * @deprecated Use `Config\Security` $regenerate property instead of using this property. * * @var bool */ public $CSRFRegenerate = false; /** * -------------------------------------------------------------------------- * CSRF Redirect * -------------------------------------------------------------------------- * * Redirect to previous page with error on failure? * * @deprecated Use `Config\Security` $redirect property instead of using this property. * * @var bool */ public $CSRFRedirect = false; /** * -------------------------------------------------------------------------- * CSRF SameSite * -------------------------------------------------------------------------- * * Setting for CSRF SameSite cookie token. Allowed values are: * - None * - Lax * - Strict * - '' * * Defaults to `Lax` as recommended in this link: * * @see https://portswigger.net/web-security/csrf/samesite-cookies * @deprecated `Config\Cookie` $samesite property is used. * * @var string */ public $CSRFSameSite = 'Lax'; /** * -------------------------------------------------------------------------- * Content Security Policy * -------------------------------------------------------------------------- * * Enables the Response's Content Secure Policy to restrict the sources that * can be used for images, scripts, CSS files, audio, video, etc. If enabled, * the Response object will populate default values for the policy from the * `ContentSecurityPolicy.php` file. Controllers can always add to those * restrictions at run time. * * For a better understanding of CSP, see these documents: * * @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/ * @see http://www.w3.org/TR/CSP/ * * @var bool */ public $CSPEnabled = false; } </code></pre> <p>我的安全课程</p> <pre><code><?php namespace Config; use CodeIgniter\Config\BaseConfig; class Security extends BaseConfig { /** * -------------------------------------------------------------------------- * CSRF Protection Method * -------------------------------------------------------------------------- * * Protection Method for Cross Site Request Forgery protection. * * @var string 'cookie' or 'session' */ public $csrfProtection = 'cookie'; /** * -------------------------------------------------------------------------- * CSRF Token Randomization * -------------------------------------------------------------------------- * * Randomize the CSRF Token for added security. * * @var bool */ public $tokenRandomize = true; /** * -------------------------------------------------------------------------- * CSRF Token Name * -------------------------------------------------------------------------- * * Token name for Cross Site Request Forgery protection. * * @var string */ public $tokenName = 'csrf_test_name'; /** * -------------------------------------------------------------------------- * CSRF Header Name * -------------------------------------------------------------------------- * * Header name for Cross Site Request Forgery protection. * * @var string */ public $headerName = 'X-CSRF-TOKEN'; /** * -------------------------------------------------------------------------- * CSRF Cookie Name * -------------------------------------------------------------------------- * * Cookie name for Cross Site Request Forgery protection. * * @var string */ public $cookieName = 'csrf_cookie_name'; /** * -------------------------------------------------------------------------- * CSRF Expires * -------------------------------------------------------------------------- * * Expiration time for Cross Site Request Forgery protection cookie. * * Defaults to two hours (in seconds). * * @var int */ public $expires = 7200; /** * -------------------------------------------------------------------------- * CSRF Regenerate * -------------------------------------------------------------------------- * * Regenerate CSRF Token on every submission. * * @var bool */ public $regenerate = false; /** * -------------------------------------------------------------------------- * CSRF Redirect * -------------------------------------------------------------------------- * * Redirect to previous page with error on failure. * * @var bool */ public $redirect = true; /** * -------------------------------------------------------------------------- * CSRF SameSite * -------------------------------------------------------------------------- * * Setting for CSRF SameSite cookie token. * * Allowed values are: None - Lax - Strict - ''. * * Defaults to `Lax` as recommended in this link: * * @see https://portswigger.net/web-security/csrf/samesite-cookies * * @var string * * @deprecated `Config\Cookie` $samesite property is used. */ public $samesite = 'Lax'; } </code></pre> <p>请帮助我在启用 csrf 时使表单提交正常工作。</p> <p>我的 Codeigniter4 应用程序的视图具有提交表单数据的模式。当 csrf 启用时,这会发送 303 http 状态;但是,当禁用 csrf 时,表单会正确提交数据。 我应该在哪里更正才能使其在启用 csrf 的情况下工作。</p> </question> <answer tick="false" vote="0"> <p>您需要在ajax参数中添加csrf_token和hash,或者在表单中包含csrf_field。</p> <pre><code>For Ajax var token = '<?= csrf_token(); ?>'; var hash = '<?= csrf_hash(); ?>'; ajaxParam = { ... , [token] : hash }; $.ajax({....}); For Form submit add in form html <?= csrf_field(); ?> </code></pre> </answer> </body></html>
Javascript 在模态窗口关闭时停止 HTML5 视频播放
我在模态窗口上有一个 html5 视频元素。当我关闭窗口时,视频继续播放。我是 JS 的新手。有没有一种简单的方法可以将视频播放停止功能与
Google Apps 脚本 - 调用“google.script.run.function();”时,.HTML 模态菜单不执行 .gs 函数
我遇到了一个奇怪的 GAS 问题,每当我生成模态菜单并提交它时,有时 google.script.run 可以工作,有时它根本不执行我想要的功能。 有一个...
Material ui onClose 作为disableBackdropClick 的替代品
目前我有一个对话框 来自文档 https://materia...
为什么这个自定义模式不能在我的 WordPress 网站标题上工作?
如果我在标题中放置自定义 HTML 块并放置我的代码,则会出现该按钮,但该按钮的功能不起作用。如果我将自定义 HTML 放置在页面上其他任何位置的块中...
使用 showModal 打开时,HTML <dialog> 元素如何按照正常流程定位?
当将 元素与 .show() 一起使用时,它会根据正常位置等 CSS 属性进行定位。 是否可以使用 .showModal() 进行相同的定位? 即使在使用时 d...
我正在一个 Angular 项目(版本 16)中工作,我想构建一个带有“不再显示”复选框的对话框模式。 该过程将是这样的: 用户访问 Web 应用程序....
我在网上找到了一些代码,允许我创建和设计一个模式窗口,供访问者注册我们的时事通讯,但我希望这个模式窗口在打开索引页面时自动弹出...
在 Bootstrap Modal 中保存 Laravel 表单中的数据
我有一个引导模式对话框,它使用 laravel 形式来注册用户。 这是代码: 我有一个引导模式对话框,它使用 laravel 表单来注册用户。 这是代码: <div id="addPenggunaModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3 id="ModalLabel">Tambah Pengguna Baru</h3> </div> <div class="modal-body"> {{ Form::open(array('url'=>'users/addpengguna','class'=>'form-horizontal', 'method'=> 'POST')) }} <ul> @foreach($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> <div class="control-group"> <label for="firstname" class="control-label">First Name:</label> <div class="controls"> {{ Form::text('firstname', null, array('class'=>'span3', 'placeholder'=>'First Name')) }} </div> </div> <!-- /field --> <div class="control-group"> <label for="lastname" class="control-label">Last Name: </label> <div class="controls"> {{ Form::text('lastname', null, array('class'=>'span3', 'placeholder'=>'Last Name')) }} </div> </div> <!-- /field --> <div class="control-group"> <label for="email" class="control-label">Email Address: </label> <div class="controls"> {{ Form::text('email', null, array('class'=>'span3', 'placeholder'=>'Email Address')) }} </div> </div> <!-- /field --> <div class="control-group"> <label for="password" class="control-label">Password:</label> <div class="controls"> {{ Form::password('password', array('class'=>'span3', 'placeholder'=>'Password')) }} </div> </div> <!-- /field --> <div class="control-group"> <label for="confirm_password" class="control-label">Confirm Password:</label> <div class="controls"> {{ Form::password('password_confirmation', array('class'=>'span3', 'placeholder'=>'Confirm Password')) }} </div> </div> <!-- /field --> <div class="control-group"> <label for="type_user" class="control-label">Tipe Pengguna:</label> <div class="controls"> {{ Form::radio('level', '1'); }} Supervisor {{ Form::radio('level', '0'); }} Sales </div> </div> <!-- /field --> </form> </div> <div class="modal-footer"> {{ Form::submit('Simpan', array('class'=>'button btn btn-primary','id'=>'mdl_save_change'))}} <button class="btn" data-dismiss="modal" aria-hidden="true">Batal</button> </div> {{ Form::close() }} </div> 然后我使用控制器保存详细信息: public function postAddpengguna(){ /* function to add user in data pengguna */ $validator = Validator::make(Input::all(), User::$rules); if($validator -> passes()){ $user = new User; $user->firstname = Input::get('firstname'); $user->lastname = Input::get('lastname'); $user->email = Input::get('email'); $user->password = Hash::make(Input::get('password')); $user->level = Input::get('level'); /* save the following details */ $user->save(); return Redirect::to('pengguna'); } else { return Redirect::to('index'); } } 但是表单不会将任何数据保存到数据库中。我有另一个名为注册的页面,它可以工作。 我的问题: 如何从laravel表单提交跟踪POST,有浏览器扩展吗? 如何在 laravel 中跟踪错误日志 你知道我的问题是怎么回事吗? 提前谢谢您。 更新 这是描述其工作原理的屏幕截图。 引导模式: 当我按下提交按钮(模式中的蓝色按钮)时,我希望它将数据保存到数据库。函数 php 如上所示。 PS。我不使用任何 AJAX 来调用 FORM 中的值。但是当我使用 AJAX 时,总是出错,因为缺少 TOKEN。 首先检查表单的action和_token字段。要在表单中添加令牌字段,您应该在表单中包含以下行: <input type="hidden" name="_token" value="{{csrf_token()}}"> 要在项目中重复使用引导模式,您可以检查此Github链接 在最新版本的 laravel 5 中,您可以使用快捷方式获取 token 字段。 <form ... > {!! csrf_field() !!} </form> 在这种情况下,你会得到类似的东西 <input type="hidden" name="_token" value="hpyL7cUbCMFBGRfCi2dpzE5XHGj8WuyY2jqloKRx"> 在任何情况下,您都可以调用 csrf_token() 来获取令牌字符串,无论如何,我真的更喜欢 csrf_field() 替代方案。 您可以将此代码与您的ajax代码一起使用: $(function() { $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': {!! json_encode(csrf_token()) !!} } }); });
我想使用 jQuery 将 div 的内容显示为模式对话框。 有没有什么方法可以在不使用 Bootstrap 或其他任何东西的情况下做到这一点......? 我想以我自己的方式通过 ...
Bootstrap Modal 不会在 X 或关闭按钮上关闭,但会在 ESC 或单击覆盖层上关闭
嗯,标题说明了一切。我有一个默认的(从 Bootstrap 文档复制的)模态,它使用 $('#myModal').modal(); 打开但在任何情况下,模式都会以解雇 X 或取消 bu...
cordova 页面加载正在触发未打开的 Modal ng-repeat 脚本运行
我有一个模板 PageA 的控制器。 PageA 上有一个模式,仅在用户单击按钮时打开。 Modal 中是 ng-repeat;使用 ng-init,当 ng-repeat 完成时 ($last) t...
我正在努力让模式在单击按钮时获得动画效果。模态框隐藏时不得占用空间。所以我想在未显示时使用 display none 。当点击按钮时...