Need to remove a character from a form upon submission.

Hi, we have a gift certificate form. magickitchen.com/gift/gift-certificates.html  - cart is written in PERL,

In the amount window, if someone enters a dollar sign before the number, they get an error. Error: Invalid input for VALUE: $|$35|

Is there a simple way to remove the $ sign if someone enters it, as the form is submitted? Or is there another simple solution?

As an interim measure, I'll be changing the placeholder text. Thanks.
Melody ScottAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David FavorLinux/LXD/WordPress/Hosting SavantCommented:
To remove a $ character from any string...

$str =~ s/\$//go;

Open in new window

Melody ScottAuthor Commented:
Thanks... I'll need a little more explanation, I think. I know that's jquery, but I'm not sure how or where to add it to make that work. Thanks, David.
David Johnson, CD, MVPOwnerCommented:
let your control only accept numbers
https://jsfiddle.net/Behseini/ue8gj52t/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Melody ScottAuthor Commented:
That's pretty cool, thanks!
Melody ScottAuthor Commented:
Not sure why it isn't working here though: http://dev.magickitchen.com/gift/gift-certificates.html  scroll down to the form.

I have this in the head tag:
     <script language="javascript" type="text/javascript" src="/js/cart/jquery-1.7.1.min.js"></script>
 <script>
 $(".allownumericwithdecimal").on("keypress keyup blur",function (event) {
            //this.value = this.value.replace(/[^0-9\.]/g,'');
     $(this).val($(this).val().replace(/[^0-9\.]/g,''));
            if ((event.which != 46 || $(this).val().indexOf('.') != -1) && (event.which < 48 || event.which > 57)) {
                event.preventDefault();
            }
        });
	</script>

Open in new window


And the input field has: <input class="form-control allownumericwithdecimal" name="gift_value" id="gift_value" type="text" placeholder="Amount (10 - 2500)*- enter without dollar sign">
Melody ScottAuthor Commented:
Thanks gentlemen, the cart developer made changes to fix it, but this would have worked as well. Appreciated!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.