• Page 1 of 1
  • 1
Forum moderator: bigblog  
uCoz Community » For Webmasters » Custom Solutions » Manipulate strings in blank field of Editing Entry Page
Manipulate strings in blank field of Editing Entry Page
khen
Posts: 475
Reputation: 13

Message # 1 | 3:53 AM
How to manipulate strings in the blank field of Editing Entry Page of my Ad Board.

I have a blank field in the Editing Entry Page of Ad Board. This blank field is intended for the price of the Ad item. I want to manipulate the characters to be entered in the blank field.

As the user types the characters, the user is force to enter numeric characters. Non-numeric characters will be removed on the fly.

This is the field form to be manipulated:

Code
<input type="text" id="bdF13" size="35" class="manFlOth1" style="width:100%;" name="other1" value="Php 3,600,000" maxlength="100">


Please help...

Post edited by khen - Thursday, 2016-09-01, 3:57 AM
joexyz
JOE-vascript
Posts: 1770
Reputation: 78

Message # 2 | 7:25 AM
khen, insert the following code after the $BODY$ tag in the Entry adding/editing page:
Code
<script type="text/javascript">
$("#bdF13").keyup(function () {
    var newValue = $(this).val().replace(/[^0-9]/g,'');
    $(this).val(newValue);    
});  
</script>

hey i'm joe and i do not work for the company anymore, please contact other staff or tech support
icon by ch-chau

sometimes i lurk here
khen
Posts: 475
Reputation: 13

Message # 3 | 1:55 PM
thanks bigblog. You're truly a great helper. You're such a blessing. But there's another thing I want to add. How can I limit the number of characters (numbers) into 10 digits?
joexyz
JOE-vascript
Posts: 1770
Reputation: 78

Message # 4 | 4:45 PM
khen, use the following code which you need to paste before the </script> tag closing of the code from my previous message:
Code
$(document).ready(function() {
  $("bdF13").attr('maxlength',10);
});

Here's a working fiddle: https://jsfiddle.net/osrobcgp/

Tip: You might wanna use
placeholder="Php 3,600,000"
instead of
value="Php 3,600,000"
because it would work and look better. smile

hey i'm joe and i do not work for the company anymore, please contact other staff or tech support
icon by ch-chau

sometimes i lurk here
uCoz Community » For Webmasters » Custom Solutions » Manipulate strings in blank field of Editing Entry Page
  • Page 1 of 1
  • 1
Search: