Instead of a calculation field for the countdown field, make it a plain number field, and attach a script trigger to the text field - OnObjectModify. Use a script like this:
Set Field [ Your_table::Countdown ; 500 - Length ( Your_table::Text_field ) ]
If [ Length ( Your_table::Text_field ) = 475 ]
Show Custom Dialog [ "Countdown" ; "You have 25 characters left." ]
Else If [ Length ( Your_table::Text_field ) > 500 ]
Set Field [ Your_table::Countdown ; "0" ]
Show Custom Dialog [ "Countdown" ; "No more characters left." ]
Set Field [ Your_table::Text_field ; Left ( Your_table::Text_field ; Length ( Your_table::Text_field ) - 1 ) ]
This will show a warning dialog box when the text reaches 475 characters. When it hits 501 characters another dialog pops up and the last character is deleted, limiting the field to 500 characters.
Thanks Nick, it works well..
Can this be script be adapted to count lines of text instead of characters. As Carriage Returns (Enter) counts as one character.
As far as I know, FMP doesn't have any function for counting lines in a text field. I think your best bet is to play around with the character count and maybe adjust the size of the text field on the layout to get the results you want.