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 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建