[Auction House]Adding commas at the prices
#1
fs_williamk92
Posted 28 June 2008 - 16:56
Then I'll have to waste time counting the zeros and I hate that :?
HCS can add commas after every third digit so 20000000golds becomes 20,000,000golds and I will know it's 20M immediately
That will be much more convenient
#2
fs_sleepsalot
Posted 28 June 2008 - 17:47
#3
fs_jimmyjoe
Posted 28 June 2008 - 18:09
#4
Posted 28 June 2008 - 18:14
<form method="post" action="index.php">
>>
<form method="post" action="index.php" onSubmit="return validateMyForm();">
And add the following bit of JavaScript code...
function validateMyForm() {
var minBid = document.forms[0].minbid.value;
var maxBid = document.forms[0].buynow.value;
var tokens = null;
if (minBid.indexOf(",") > 0) {
tokens = minBid.split(",");
minBid = "";
for (var i = 0; i < tokens.length; i++) {
minBid = "" + minBid + "" + tokens[i] + "";
}
if (minBid == "" + parseInt(minBid) + "") {
document.forms[0].minbid.value = parseInt(minBid);
}
else {
alert("ERROR: Invalid minimum bid price!\nPlease check your minimum bid value and resubmit the form.");
return false;
}
}
else {
if (minBid == "" + parseInt(minBid) + "") {
document.forms[0].minbid.value = parseInt(minBid);
}
else {
alert("ERROR: Invalid minimum bid price!\nPlease check your minimum bid value and resubmit the form.");
return false;
}
}
if (maxBid != "") {
tokens = null;
if (maxBid.indexOf(",") > 0) {
tokens = maxBid.split(",");
maxBid = "";
for (var i = 0; i < tokens.length; i++) {
maxBid = "" + maxBid + "" + tokens[i] + "";
}
if maxBid == "" + parseInt(maxBid) + "") {
document.forms[0].buynow.value = parseInt(maxBid);
}
else {
alert("ERROR: Invalid buy now price!\nPlease check your buy now value and resubmit the form.");
return false;
}
}
else {
if (maxBid == "" + parseInt(maxBid) + "") {
document.forms[0].buynow.value = parseInt(maxBid);
}
else {
alert("ERROR: Invalid buy now price!\nPlease check your buy now value and resubmit the form.");
return false;
}
}
minBid = parseInt(minBid);
maxBid = parseInt(maxBid);
if (minBid > maxBid) {
alert("Your buy now price cannot be less then your minimum bid price, please check your values and try again.");
return false;
}
}
return true;
}Now it should be as simple as copy paste... I tested this script with actual string values for the min bid and max bid with alerts on success instead of appending the value to the form element...
#5
Posted 28 June 2008 - 18:41
#6
fs_vampirarmy
Posted 28 June 2008 - 23:19
#7
Posted 29 June 2008 - 00:32
its an ok suggestion... but make it optional.. and also add some other common separators like '.' or ' '...
The difference between that and what I posted in code, while you were posting your reply is so minor, I can just edit my last post in a quote with the change...
Let me make this an easier suggestion...
<form method="post" action="index.php">
>><form method="post" action="index.php" onSubmit="return validateMyForm();">
And add the following bit of JavaScript code...function validateMyForm() { var minBid = document.forms[0].minbid.value; var maxBid = document.forms[0].buynow.value; var tokens = null; var tokenizer = new Array(); tokenizer[0] = ","; tokenizer[1] = "."; tokenizer[2] = " "; var userTokenPref = getUserTokenizer(); // returns a val of 0, 1, or 2... var strKey = tokenizer[userTokenPref]; if (minBid.indexOf(strKey) > 0) { tokens = minBid.split(strKey); minBid = ""; for (var i = 0; i < tokens.length; i++) { minBid = "" + minBid + "" + tokens[i] + ""; } if (minBid == "" + parseInt(minBid) + "") { document.forms[0].minbid.value = parseInt(minBid); } else { alert("ERROR: Invalid minimum bid price!\nPlease check your minimum bid value and resubmit the form."); return false; } } else { if (minBid == "" + parseInt(minBid) + "") { document.forms[0].minbid.value = parseInt(minBid); } else { alert("ERROR: Invalid minimum bid price!\nPlease check your minimum bid value and resubmit the form."); return false; } } if (maxBid != "") { tokens = null; if (maxBid.indexOf(strKey) > 0) { tokens = maxBid.split(strKey); maxBid = ""; for (var i = 0; i < tokens.length; i++) { maxBid = "" + maxBid + "" + tokens[i] + ""; } if maxBid == "" + parseInt(maxBid) + "") { document.forms[0].buynow.value = parseInt(maxBid); } else { alert("ERROR: Invalid buy now price!\nPlease check your buy now value and resubmit the form."); return false; } } else { if (maxBid == "" + parseInt(maxBid) + "") { document.forms[0].buynow.value = parseInt(maxBid); } else { alert("ERROR: Invalid buy now price!\nPlease check your buy now value and resubmit the form."); return false; } } minBid = parseInt(minBid); maxBid = parseInt(maxBid); if (minBid > maxBid) { alert("Your buy now price cannot be less then your minimum bid price, please check your values and try again."); return false; } } return true; }
Now it should be as simple as copy paste... I tested this script with actual string values for the min bid and max bid with alerts on success instead of appending the value to the form element...
Code edited to allow for the preference idea that JJ wanted...
#8
Posted 29 June 2008 - 00:53
Let me make this an easier suggestion...
<form method="post" action="index.php">
>><form method="post" action="index.php" onSubmit="return validateMyForm();">
And add the following bit of JavaScript code...function validateMyForm() { var minBid = document.forms[0].minbid.value; var maxBid = document.forms[0].buynow.value; var tokens = null; if (minBid.indexOf(",") > 0) { tokens = minBid.split(","); minBid = ""; for (var i = 0; i < tokens.length; i++) { minBid = "" + minBid + "" + tokens[i] + ""; } if (minBid == "" + parseInt(minBid) + "") { document.forms[0].minbid.value = parseInt(minBid); } else { alert("ERROR: Invalid minimum bid price!\nPlease check your minimum bid value and resubmit the form."); return false; } } else { if (minBid == "" + parseInt(minBid) + "") { document.forms[0].minbid.value = parseInt(minBid); } else { alert("ERROR: Invalid minimum bid price!\nPlease check your minimum bid value and resubmit the form."); return false; } } if (maxBid != "") { tokens = null; if (maxBid.indexOf(",") > 0) { tokens = maxBid.split(","); maxBid = ""; for (var i = 0; i < tokens.length; i++) { maxBid = "" + maxBid + "" + tokens[i] + ""; } if maxBid == "" + parseInt(maxBid) + "") { document.forms[0].buynow.value = parseInt(maxBid); } else { alert("ERROR: Invalid buy now price!\nPlease check your buy now value and resubmit the form."); return false; } } else { if (maxBid == "" + parseInt(maxBid) + "") { document.forms[0].buynow.value = parseInt(maxBid); } else { alert("ERROR: Invalid buy now price!\nPlease check your buy now value and resubmit the form."); return false; } } minBid = parseInt(minBid); maxBid = parseInt(maxBid); if (minBid > maxBid) { alert("Your buy now price cannot be less then your minimum bid price, please check your values and try again."); return false; } } return true; }
Now it should be as simple as copy paste... I tested this script with actual string values for the min bid and max bid with alerts on success instead of appending the value to the form element...
OMG Dark your a genius. Can i please buy your brain for 1 gold ?..
LOL
This is a very good suggestion
#9
fs_bladeboss
Posted 29 June 2008 - 18:31
#10
Posted 29 June 2008 - 18:39
Did you know that there are likely over 2000 rouge black holes in our galaxy alone. Each of them can reach very high speeds, even in space terms, are each capable of destroying anything in their path, and are invisible. Well, goodnight!
#11
Posted 29 June 2008 - 21:14
OMG Dark your a genius. Can i please buy your brain for 1 gold ?..
LOL
This is a very good suggestion
DA, you did something wonderful. Ignore the posts like Dumdude's -- they're jealous idiots.
How am i an idiot ?
To me it seems like your an idiot for posting crap on the forum and trying to turn this into an FLAMING THREAD
#12
fs_greggacam
Posted 30 June 2008 - 04:37
its an ok suggestion... but make it optional.. and also add some other common separators like '.' or ' '...
Yes, the period is used in all Latin American countries and more
#13
fs_onemember
Posted 30 June 2008 - 08:24
Or space: 1 000 000
I would be happy both ways.
#14
Posted 30 June 2008 - 20:33
#15
fs_williamk92
Posted 02 July 2008 - 00:17
#16
Posted 05 July 2008 - 18:58
#17
Posted 11 July 2008 - 00:59
#18
Posted 14 July 2008 - 15:32
#19
Posted 16 July 2008 - 16:04
#20
Posted 03 August 2008 - 01:27
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users

