November 25, 200421 yr Newbies I want to limit the number of characters a user can enter into a text area on a form. before i put any scripts on my form when the user edits the fields and clicks update, everything works well and the db fields are updated. However once i put the javascript to limit the number of characters in my textarea and then submit the form i get an "unknown error number 102". I know filemaker says this error is about incorrect links or field names but not in this case. Below is the javascript that i have used: <head> <script language="javascript" type="text/javascript"> function limitText(limitField, limitCount, limitNum){ if (limitField.value.length > limitNum){ limitField.value = limitField.value.substring(0,limitNum); }else { limitCount.value = limitNum - limitField.value.length; } } </script> </head> <body> <table> <tr> <td class="style1"><div align="right">Contents</div></td> <td><textarea name="limitedtextarea" onKeyDown="limitText(this.form.limitedtextarea,this.form.countdown,100);" onKeyUp="limitText(this.form.limitedtextarea,this.form.countdown,100);">[FMP-field:drivingsection]</textarea><br> <font size="1">(Maximum characters: 100)<br>You have <input readonly type="text" name="countdown" size="3" value"100"> characters left.</font></td> </tr> Once i put this javascript in the textarea tag i get the error. Has anyone come across this before? Or know of another way i can limit a textarea....the ultimate goal is to limit it to a certain amount of characters based on contents of another field. I have just started with limiting it to 100 characters to test if it would work. Unfortunetly, it doesnt. Any help much appreciated....
November 25, 200421 yr This is one that I use: <tr><td>Establishment Description:<br>(Limited to 350 characters, approx 60 words)</td> <td colspan="2"><textarea name="estab_desc" cols="38" rows="4"><?php echo $estab_desc ?></textarea></td></tr> And the Javascript in the <head> <script> function validate() { with (document.estabfm) { var subOK = true; sEstab_Desc = estab_desc.value; if (sEstab_Desc.length > 350) { subOK = false; alert ("The Description is " + estab_desc.value.length + " characters longnPlease shorten!!!"); }; if (subOK) { submit(); }; }; }; </script> I use this in the <form> tag: onsubmit="validate();return false;"> Remember that this: name="limitedtextarea" must be a name of one of the fields in your database. Garry
Create an account or sign in to comment