Ryan Bloom
Posts: 0
Joined: Tue Feb 12, 2013 6:24 pm

How to add two fields and display in text area?

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....

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to add two fields and display in text area?

I think
totalcost = Tiggzi('TotalCost');

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

Ryan Bloom
Posts: 0
Joined: Tue Feb 12, 2013 6:24 pm

How to add two fields and display in text area?

Hi Max,

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

Ryan Bloom
Posts: 0
Joined: Tue Feb 12, 2013 6:24 pm

How to add two fields and display in text area?

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);

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to add two fields and display in text area?

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

Ryan Bloom
Posts: 0
Joined: Tue Feb 12, 2013 6:24 pm

How to add two fields and display in text area?

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

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to add two fields and display in text area?

No, you would need to write the JavaScript.

Ryan Bloom
Posts: 0
Joined: Tue Feb 12, 2013 6:24 pm

How to add two fields and display in text area?

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);

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to add two fields and display in text area?

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.

Return to “Issues”