问题标签 [codeigniter-form-helper]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
2257 浏览

php - 如何使用条件选项创建表单

我想创建一个带有两个下拉框的表单,以便第二个下拉列表中的选项取决于第一个下拉列表中的选项。因此,Dropdown1 可能会要求用户选择 CourseA 或 CourseB,而 Dropdown2 可能会显示日期集 - 但日期会根据 Dropdown1 中的选择而有所不同。

我曾尝试使用 post 数组来设置 Dropdown2 选项,但后来意识到它在提交表单之前没有设置。我的问题发生在表单提交之前。

任何人都可以建议这样做的方法吗?我正在使用 codeigniter,但认为这是 php 而不是 codeigniter 问题。

0 投票
2 回答
1702 浏览

codeigniter - 上课

<option>是否可以使用 CodeIgniter在标签中添加类属性?

如果没有,如何扩展 Form helper 来支持这个?复杂吗?

0 投票
2 回答
175 浏览

jquery - How can I overcome the need to reuse input names when processing them with CodeIgniter's input class?

I have a view called volunteer_edit. Within volunteer_edit, I use jQuery to loop through an array of project ID's and, for each project ID, create a tab. The jQuery tabs plugin turns each link within an unordered list item into a tab that is filled with the html to which the link points:

In my case, each links sends a different project id as a parameter to a view called project_edit. Within project_edit there is a form:

When the form is submitted I use $this->input->post() to get the contents of the form's input elements so I can supply them to my database:


This all works perfectly on the first tab. However, on every subsequent tab, when the form is submitted, the first tab's contents are supplied to $this->input->post(). I assume this is because, when switching between tabs, the inactive tabs remain on the page and have their "display" property set to "none". Therefore, only the first element with the name attribute matching the first parameter of $this->input->post() makes it into the post array (the first input with name="title", the first input with name="project", etc).

How can I overcome this limitation? I would prefer that only the active (currently displayed) tab be submitted.

0 投票
2 回答
3247 浏览

php - 我应该使用 CodeIgniter html 还是表单助手类?

使用这些类对性能或安全问题有好处吗,因为我们知道 HTML 应该是纯 HTML。
例如

好于

那我们为什么要使用

0 投票
2 回答
2213 浏览

forms - CodeIgniter:具有许多输入的表单的控制器结构

我正在使用 CodeIgniter 开发一个网站,并试图遵守“胖模型/瘦控制器”范式,但在涉及包含具有大量输入的表单的页面时遇到了一些问题。下面的代码是我用来定义地址字段输入的代码

我的控制器的一部分(我在其中定义表单输入及其属性):

我的视图的一部分(减去所有用于定位表单输入的 HTML):

我觉得我的控制器过于冗长,但如果我打算使用表单助手在我的视图中生成表单输入,我想不出有什么替代方法来组织表示我的表单所需的信息. 这是做事的正确方法,还是有更好的方法?

0 投票
1 回答
1776 浏览

codeigniter - 从提交表格
codeigneter 中的 html 值

当从 div html 提交值时,我在 codeigneter 中使用表单时遇到问题,

示例视图

在 div id="contentbox" 中设置 contenteditable="true",我将获得动态值,

控制器

但是在控制器中我无法获得值 div id="contentbox" ,我在输入数据库时​​遇到问题,当我在 div id="contentbox" 中键入“sometext”时,值始终为“0”

0 投票
1 回答
1556 浏览

php - 如果用户不上传任何文件,我如何默认提供文件以供上传,m使用codeigniter

我如何在默认情况下为codeignitor中的上传类提供上传文件(例如来自数据库),如果用户不上传任何默认文件,则应考虑使用codeigniter。

帮助表示赞赏。:)

0 投票
3 回答
363 浏览

php - 在 CodeIgniter 中使用分页时数据量不一致

我想使用 CodeIgniter 中的分页库执行大量数据。我一直在实施它并且它有效。但是,我有一个问题——每页的数据量并不一致。

这是我如何制作它的简单代码......

控制器

模型

看法

分页效果很好,但每页的数据量与我在控制器中定义的不一致。我认为问题是由我在模型中使用的查询引起的 - 会话标题。

我希望数据每页执行 10 个数据,但在第 1 页只有 5 个数据,第 2 页只有 4 个数据 - 不一致。也许问题也在视图中。我应该怎么办?非常感谢。

0 投票
1 回答
1602 浏览

forms - 在输入中使用 0 值时出现 Codeigniter 验证错误

我认为 codeigniter 表单验证类中有一个错误。

如果值大于零但如果它是“0” set_value 函数不起作用,我的代码工作得很好:

控制器:

看法:

我做错了什么还是这是一个错误?

0 投票
1 回答
89 浏览

php - CI 只返回 Validation_error 而不是整个表单页面

我在同一页面上查看了登录和注册表单。我想只返回错误消息而不刷新整个页面。我怎样才能做到这一点?