Page 3 of 3

How to add two fields and display in text area?

Posted: Sat Feb 16, 2013 12:28 am
by Ryan Bloom

Hello again Marina,

I am looking to set an alert that is based off of a minimum value for the "TotalCost".

I want to have the alert happen once the calculation happens for the TotalCost. If the TotalCost is less than 7,000 I want to have an alert pop up saying The Total Is Too Small and then have a function zero out the ap and mp fields. I have tried the alert function:

var ap = Tiggzi('AP').val(),
totalcost = Tiggzi('TotalCost'),
mp = Tiggzi('MP').val();

var apNumber = parseFloat(ap),
totalprice = parseFloat(totalcost),
mpNumber = parseFloat(mp);

if (totalpriceNumber < 7000) {
totals= "TooSmall"
}

alert("The Total Is Too Small);

But it is not working....


How to add two fields and display in text area?

Posted: Sat Feb 16, 2013 5:13 am
by maxkatz

I think
totalcost = Tiggzi('TotalCost');

should be
totalcost = Tiggzi('TotalCost').val();


How to add two fields and display in text area?

Posted: Sat Feb 16, 2013 5:38 am
by Ryan Bloom

Hi Max,

The field TotalCost is a label field so I have it set at .text which should work, It is still not alerting.


How to add two fields and display in text area?

Posted: Sat Feb 16, 2013 5:38 am
by Ryan Bloom

var ap = Tiggzi('AP').val(),
totalcost = Tiggzi('TotalCost').text(),
mp = Tiggzi('MP').val();

var apNumber = parseFloat(ap),
totalprice = parseFloat(totalcost),
mpNumber = parseFloat(mp);

if (totalpriceNumber < 7000) {
totals= "TooSmall"
}

alert("The Total Is Too Small);


How to add two fields and display in text area?

Posted: Sat Feb 16, 2013 5:45 am
by maxkatz

Place an alert or console.log(..) after each statement to find out where it fails.


How to add two fields and display in text area?

Posted: Sat Feb 16, 2013 6:02 am
by Ryan Bloom

Would it be possible to accomplish this through the set property event through the tiggzi interface instead of using javascript?


How to add two fields and display in text area?

Posted: Sat Feb 16, 2013 6:36 am
by maxkatz

No, you would need to write the JavaScript.


How to add two fields and display in text area?

Posted: Sat Feb 16, 2013 4:55 pm
by Ryan Bloom

I have tried what I believe to be the right function but it is still not working, the code is:

var ap = Tiggzi('AP').val(),
totalcost = Tiggzi('TotalCost').text(),
mp = Tiggzi('MP').val();

var apNumber = parseFloat(ap),
totalprice = parseFloat(totalcost),
mpNumber = parseFloat(mp);

if (totalpriceNumber < 7000) {
totals= "TooSmall"
}

alert("The Total Is Too Small);


How to add two fields and display in text area?

Posted: Sat Feb 16, 2013 5:00 pm
by maxkatz

You are missing ; after these statements:

var apNumber = parseFloat(ap),
totalprice = parseFloat(totalcost),
...
totals= "TooSmall"

If still doesn't work, place a print statement after each line to find out what one fails.