Expand my Community achievements bar.

What is the best way to validate?

Avatar

Level 2
This image is a template Im using to create an expense form.



http://img160.imageshack.us/img160/963/form25vp.jpg



I have a specials item section which is just totaled from all the Special Items fields.



Was able to create a totals script to but could not get it to leave the field blank. Thanks to Justin Klei using this script it totals without a problem.



This has been placed it the Calculate section of the Total field.



var totalval = form1.costs.spei1.rawValue + form1.costs.spei2.rawValue;

if (totalval == 0 || totalval == null || totalval == "")

{

this.rawValue = "";

}

else

{

this.rawValue = totalval;

}



If the user types $12.00 into the Special Items 1 field they then are able to transfer this to the main table by clicking on any of the Special column fields. In each field Ive got the following script that will allow the user to click on any of the Special column fields and only apply the total once. If the user clicks on the Tuesday field and then decides to move the total to Sunday all they have to do is click on the Sunday field.



This have been placed in the mouse down event (will create a transparent button later).



if (this.rawValue)

{

sunspe.rawValue = ""

} else {

sunspe.rawValue = spetot.rawValue

monspe.rawValue = ""

tuespe.rawValue = ""

wedspe.rawValue = ""

thuspe.rawValue = ""

frispe.rawValue = ""

satspe.rawValue = ""

}



Ive just reused the script for each field and moved the spetot.rawValue to the appropriate day.



Here is my question.



If the user types a figure in Special Items 1 and then applies that figure to the Special column and then decides to add another figure to Special Items 2, what is the best what to validate the Special column?



Would having a message pop up be the best?



This has been placed in the Validate section of the Total field.



if (spetot.rawValue != sunc1.rawValue)

{

app.alert("There has been a change to the Special Item Total \n Please update the Special column.");

}



Is it possible for the form to automatically update the figure if it has been applied to the Special column?



The problem I have with the message currently is obviously it pops up every time you add a figure into the Special Items. Is there a way to compare only if there is a figure in the field?



Any suggestions would be appricated.
0 Replies