HubSpot Ideas

ivanoccam

Coin and other formats in forms' inputs

Forms' inputs aren't formatted as they are in the contacts section and it would be a customer loyalty action to have those formats accesible in pages. 

IE: a coin input is formatted as a plain number input.

Also, a formatting templating like in which we could write "0.00 %" and have a percentile input in form would be awesome.

Thanks

1 Reply
DJack0
Member

 

In web development, forms often contain different input types, including text, password, email, number, and more. The "coin" format in forms' inputs is not a standard HTML input type, but it might refer to a specific use case or custom implementation.

However, if you are looking to create a form field that accepts copper coin values , like for a financial application or cryptocurrency-related form, you have a few options:

  1. Text Input: You can use a regular text input and add validation to ensure the input matches the expected coin value format. For example, you can use regular expressions to validate the input for specific patterns.

  2. Number Input: If you want to allow users to input numerical values only, you can use the type="number" attribute on the input element. However, this will not provide formatting for coins like adding a currency symbol.

  3. Custom Input with Formatting: For a more user-friendly approach, you can use JavaScript or a front-end library to create a custom input that automatically formats the coin value as the user types. This could include adding a currency symbol, comma separators, or any other desired format.

Here's an example of a simple text input field for a coin value:

 

htmlCopy code
<label for="coinValue">Enter Coin Value:</label> <input type="text" id="coinValue" name="coinValue" placeholder="e.g., $0.00" pattern="^\$?\d+(,\d{3})*(\.\d{2})?$" title="Please enter a valid coin value (e.g., $0.00)">
 

In this example, the pattern attribute includes a regular expression that validates the input for a currency format like "$0.00" or "$1,000.00".

Keep in mind that the implementation details may vary depending on the specific requirements of your application and the technologies you are using. Always validate and sanitize user input on the server-side as well to ensure data integrity and security.