简体   繁体   English

使用星号屏蔽HTML表单文本字段

[英]Masking HTML Form Text Field with asterisk

I have a situation where we are encoding and then sending the phone number entered by user in the Form text field to the back end. 我有一种情况,我们编码,然后将用户在表单文本字段中输入的电话号码发送到后端。 So when the user hits submit button the value of the Phone Number text field is encoded and same encoded value becomes visible in the text field till the next page loads. 因此,当用户点击提交按钮时,电话号码文本字段的值被编码,并且相同的编码值在文本字段中变得可见,直到下一页加载。 And if user hits the back button he would still see the encoded values which again is a bad user experience. 如果用户点击后退按钮,他仍然会看到编码值,这又是糟糕的用户体验。

This encoded value may confuse the users. 该编码值可能使用户感到困惑。 Is there is solution where we can just show asterisk instead of the encoded value and at the same time the back end receives the same encoded phone number. 是否有解决方案我们只能显示星号而不是编码值,同时后端接收相同的编码电话号码。

Please share your views on this. 请分享您对此的看法。

Many Thanks, 非常感谢,

您可以将输入字段的类型从<input type="text" name="fieldname">更改为<input type="password" name="fieldname">或隐藏它<input type="text" name="fieldname" style="display: none;">

Create a hidden field, then when the form is submitted, populate the hidden field with the encoded phone number. 创建隐藏字段,然后在提交表单时,使用编码的电话号码填充隐藏字段。 Then change the value of the visible phone to * . 然后将可见手机的值更改为*

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM