doushi9856 2016-06-26 23:28
浏览 37
已采纳

创建具有多个字段的单个<input>类型[关闭]

Edited for clarity:

Although this question was answered by @grateful, I'll try to expand it in case it should prove useful to others...

My project contains a page, rsetup.php, that contains some php that accesses a MySQL database to populate the HTML portion of the page. The HTML creates a form with "standard" fields like radiobuttons, checkboxes and text fields.

One of the sections of the form has multiple instances of a database field that are used to create an optional "filter chain". The type of input field I'm looking to implements looks like:

[label][op][value]

Where label is the name of a filter, op is either ==, != or NULL and value is an arbitrary operand (usually a string). Ideally the input type will return all three subfields when queried.

The answer provided by @grateful below pointed me in the right direction. A few tweaks and it will do exactly what I need. If anyone else in the community needs a similar solution, this is a great starting point.

I'm sorry there are no code examples to illustrate this question but the project is internal to the company I work for and I'm pretty sure any public exposure would be frowned upon...

Thank you in advance for any help, 405nm

  • 写回答

1条回答 默认 最新

  • duanjianxu4288 2016-06-27 00:16
    关注

    If I understand you correctly, the tricky thing is getting the css right - making the 3 parts look like part of the same input field. To do this, it's good to give them the same class name and set their appearance attribute to 'none', ie:

      -webkit-appearance: none;
      -moz-appearance:    none;
      appearance:         none;
    

    However, having done this, you need to restyle the elemnts, hence quite a lot of css. I created an example for you on Codepen here

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端