I know this prob a really simple question.. I just need a pay to validate a text input field on my form. I know I can use the number type for HTML5 and have looked at prey_replace but I don't understand that function for the life of me..
What is the best way for me to validate a input field in my form? PHP, JQuery, Other? Just want to make sure what is inserted in the text field is in money format like 00.00 (I have set the maxlength of the text input to 5) I just need to check now to make sure only numbers or number and decimal is the only thing submitted when the form submits..
This may be overkill for what I need it for but I did find this fiddle from another question: http://jsfiddle.net/vY39r/11/ However I can't get it to work and I made sure the names match.
Here is a basic example of what I have:
<form name="setPrices" action="" method="POST">
<fieldset>
<label for="lowPrice">Low Resolution:</label>
<input type="text" class="price" id="lowPrice" name="lowPrice" value="<?php echo $low_price; ?>" maxlength="5" />
</fieldset>
<fieldset>
<label for="mediumPrice">Medium Resolution:</label>
<input type="text" class="price" id="mediumPrice" name="mediumPrice" value="<?php echo $medium_price; ?>" maxlength="5" />
</fieldset>
<fieldset>
<label for="highPrice">High Resolution:</label>
<input type="text" class="price" id="highPrice" name="highPrice" value="<?php echo $high_price; ?>" maxlength="5" />
</fieldset>
<input type="hidden" name="submitted" id="submitted" value="true" />
<button type="submit" id="submit" class="button">Save</button>
</form>