跳到内容
栏目
Fiesta

field-money

表单 人会在里面打字的字段,处于真实表单会让它们出现的状态。每一个都放在带内边距的 rst-box 里,因为表单就放在这样的卡片里。

单一货币的金额。货币代码显示在标签旁,并随表单一起提交,因此如果有人输入期间货币发生了变化,保存时就会被发现。

每个示例都能真实操作,但其中的链接不会跳转到任何地方。 HTML 显示可复制的标记。

最简

预览

把这段放进 <section rst-box><form rst-form> 里。

<div rst-field>
  <label rst-field-label for="fm_bare">票价 <span class="rst-mono">EUR</span></label>
  <input rst-input id="fm_bare" name="fm_bare" type="text" inputmode="decimal">
  <input type="hidden" name="fm_bare.locale" value="en">
  <input type="hidden" name="fm_bare.currency" value="EUR">
  <input type="hidden" name="fm_bare.seed" value="">
</div>

带一条提示

预览

把这段放进 <section rst-box><form rst-form> 里。

<div rst-field>
  <label rst-field-label for="fm_hint">票价 <span class="rst-mono">EUR</span></label>
  <input rst-input id="fm_hint" name="fm_hint" type="text" inputmode="decimal" aria-describedby="fm_hint-hint">
  <input type="hidden" name="fm_hint.locale" value="en">
  <input type="hidden" name="fm_hint.currency" value="EUR">
  <input type="hidden" name="fm_hint.seed" value="">
  <small rst-field-hint id="fm_hint-hint">例如 12.50 或 €12.50。</small>
</div>

带一个错误

预览

把这段放进 <section rst-box><form rst-form> 里。

<div rst-field>
  <label rst-field-label for="fm_error">票价 <span class="rst-mono">EUR</span></label>
  <input rst-input id="fm_error" name="fm_error" type="text" inputmode="decimal" value="12,.50" aria-invalid="true" aria-describedby="fm_error-error">
  <input type="hidden" name="fm_error.locale" value="en">
  <input type="hidden" name="fm_error.currency" value="EUR">
  <input type="hidden" name="fm_error.seed" value="">
  <small rst-field-error id="fm_error-error">请用小数点表示小数,例如 12.50。</small>
</div>