Hello All,
I am using a form where the price of items will be fetched from an embedded xml. The price written in the xml as "9,27", "11,80" . There is a column called qunatity and a column called retail price. After the price has been by the xml the user will simply enter the quantity and the retail price will calculate it by multiplying with the qunatity. So I need a proper validation for these fields price and retail price so that the '$' symbol will also come in the beginning.
Just a reminder " The prices written as "6,80" , "11,90" like this .
Thanks.
Bibhu.
Views
Replies
Total Likes
Regular Expressions are the most appropriate validation method for this requirements.
Nith
Views
Replies
Total Likes
Hello,
Would you please kindly suggest how to validate this one ?
Thanks.
Bibhu.
Views
Replies
Total Likes
Is this what you are after?
// form1.page1.subform1.table.row[0].retailPrice::calculate - (JavaScript, client)
if (quantity.isNull) {
this.rawValue = null;
}
else {
var comma = /\,/g;
var priceStr = price.rawValue;
priceStr = priceStr.replace(comma,".");
var priceNum = parseFloat(priceStr);
var retailPriceNum = (priceNum * quantity.rawValue).toFixed(2);
var retailPriceStr = retailPriceNum.toString();
this.rawValue = "$" + retailPriceStr.replace(".",",");
}
Steve
Views
Replies
Total Likes
Hello Steve,
Thanks for the example. This is what I need. But I would like to see a '$' symbol before the price as well. How to do it ?
Thanks.
Bibhu.
Views
Replies
Total Likes
Buddy I couldn't understand. Where you want to add Symbol $? Plz would you explain it?
Views
Replies
Total Likes
Hello Mahesh,
As the price is in dollar so I would like to add the dollar symbol before it as it shows in the final retail price.
Thanks.
Bibhu.
Views
Replies
Total Likes
The updated form is attached.
Steve
Views
Replies
Total Likes
Hello Steve,
Would you please say what changes you have made to the previous form ?
Thanks.
Bibhu.
Views
Replies
Total Likes
Hello Steve,
When I apply your concept to my form . I found the price validation is failing. Why so ? Could you please explain ?
Thanks.
Bibhu.
Views
Replies
Total Likes
Hello Steve,
One more thing I would like to add. Somehow I manage with the price validation. Now my problem is :
1. The '$' is not getting appended to its value.
2. In the Total price it's only multiplying the last tto digits after the comma.
Thanks.
Bibhu.
Views
Replies
Total Likes
Two changes. One, I added script to the price initalize event to add the dollar sign.
// form1.page1.subform1.table.row[0].price::initialize - (JavaScript, client)
if (this.isNull) {
this.rawValue = null;
}
else {
this.rawValue = "$" + this.rawValue;
}
Two, I added priceStr = priceStr.substring(1,priceStr.length); to the calculate event on the retailPrice to remove the dollar sign.
// form1.page1.subform1.table.row[0].retailPrice::calculate - (JavaScript, client)
if (quantity.isNull) {
this.rawValue = null;
}
else {
var comma = /\,/g;
var priceStr = price.rawValue;
priceStr = priceStr.substring(1,priceStr.length);
priceStr = priceStr.replace(comma,".");
var priceNum = parseFloat(priceStr);
var retailPriceNum = (priceNum * quantity.rawValue).toFixed(2);
var retailPriceStr = retailPriceNum.toString();
this.rawValue = "$" + retailPriceStr.replace(".",",");
}
Regarding the total price, do you have display or validation patterns defined on the object? If you send me the form I can take a look stwalker.adobe@gmail.com
Steve
Views
Replies
Total Likes
Hello Steve,
I have not defined any validation pattern in the total column. More over in the price column it's not showing any $ sign . What can be the problem?One thing I would like to add here. If i manually type some dataof the format "$9,27" and then multiply it to get the total price everything works fine. But the moment I import the xml to embed all the price data it's showing the above problem . I am totally confused.
Thanks.
Bibhu.
Views
Replies
Total Likes
If you send me the form I'd be happy to take a look stwalker.adobe@gmail.com
Steve
Views
Replies
Total Likes