|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
I just posted this in the wrong forum. Sorry.
I added Javascript to a form with 18 fields to remove CR/LF entered by the data entry person. The code is working on 9 of the fields. I can't figure out what is wrong, I double checked the boxNames and all are correct. The code is: function onRecordSave() { if( (Form.boxes("boxOrgName").content.search("\n") != -1) || (Form.boxes("boxOrgName").content.search("\r") != -1) ) { contentReplace( "boxOrgName","\n",""); contentReplace( "boxOrgName","\r",""); } if( (Form.boxes("boxContact").content.search("\n") != -1) || (Form.boxes("boxContact").content.search("\r") != -1) ) { contentReplace( "boxContact","\n",""); contentReplace( "boxContact","\r",""); } if( (Form.boxes("boxStreetAddress").content.search("\n") != -1) || (Form.boxes("boxStreetAddress").content.search("\r") != -1) ) { contentReplace( "boxStreetAddress","\n",""); contentReplace( "boxStreetAddress","\r",""); } if( (Form.boxes("boxState").content.search("\n") != -1) || (Form.boxes("boxState").content.search("\r") != -1) ) { contentReplace( "boxState","\n",""); contentReplace( "boxState","\r",""); } if( (Form.boxes("boxZIP").content.search("\n") != -1) || (Form.boxes("boxZIP").content.search("\r") != -1) ) { contentReplace( "boxZIP","\n",""); contentReplace( "boxZIP","\r",""); } if( (Form.boxes("boxCity").content.search("\n") != -1) || (Form.boxes("boxCity").content.search("\r") != -1) ) { contentReplace( "boxCity","\n",""); contentReplace( "boxCity","\r",""); } if( (Form.boxes("boxCountry").content.search("\n") != -1) || (Form.boxes("boxCountry").content.search("\r") != -1) ) { contentReplace( "boxCountry","\n",""); contentReplace( "boxCountry","\r",""); } if( (Form.boxes("boxEmail").content.search("\n") != -1) || (Form.boxes("boxEmail").content.search("\r") != -1) ) { contentReplace( "boxEmail","\n",""); contentReplace( "boxEmail","\r",""); } if( (Form.boxes("boxPhone").content.search("\n") != -1) || (Form.boxes("boxPhone").content.search("\r") != -1) ) { contentReplace( "boxPhone","\n",""); contentReplace( "boxPhone","\r",""); } if( (Form.boxes("boxFAX").content.search("\n") != -1) || (Form.boxes("boxFAX").content.search("\r") != -1) ) { contentReplace( "boxFAX","\n",""); contentReplace( "boxFAX","\r",""); } if( (Form.boxes("boxURL").content.search("\n") != -1) || (Form.boxes("boxURL").content.search("\r") != -1) ) { contentReplace( "boxURL","\n",""); contentReplace( "boxURL","\r",""); } if( (Form.boxes("boxKeywords).content.search("\n") != -1) || (Form.boxes("boxKeywords").content.search("\r") != -1) ) { contentReplace( "boxKeywords","\n",""); contentReplace( "boxKeywords","\r",""); } if( (Form.boxes("boxDescription").content.search("\n") != -1) || (Form.boxes("boxDescription").content.search("\r") != -1) ) { contentReplace( "boxDescription","\n",""); contentReplace( "boxDescription","\r",""); } if( (Form.boxes("boxRegions").content.search("\n") != -1) || (Form.boxes("boxRegions").content.search("\r") != -1) ) { contentReplace( "boxRegions","\n",""); contentReplace( "boxRegions","\r",""); } if( (Form.boxes("boxLanguage").content.search("\n") != -1) || (Form.boxes("boxLanguage").content.search("\r") != -1) ) { contentReplace( "boxLanguage","\n",""); contentReplace( "boxLanguage","\r",""); } if( (Form.boxes("boxNotes").content.search("\n") != -1) || (Form.boxes("boxNotes").content.search("\r") != -1) ) { contentReplace( "boxNotes","\n",""); contentReplace( "boxNotes","\r",""); } if( (Form.boxes("boxStatus").content.search("\n") != -1) || (Form.boxes("boxStatus").content.search("\r") != -1) ) { contentReplace( "boxStatus","\n",""); contentReplace( "boxStatus","\r",""); } if( (Form.boxes("boxCommunity").content.search("\n") != -1) || (Form.boxes("boxCommunity").content.search("\r") != -1) ) { contentReplace( "boxCommunity","\n",""); contentReplace( "boxCommunity","\r",""); } } function contentReplace(boxName, oldText, newText) { var boxContents; var newContents; var regText = new RegExp(oldText, "g"); boxContents = Form.boxes(boxName).content; newContents = boxContents.replace(regText,newText); Form.boxes(boxName).content = newContents; } } The problem fields are: Contact, Street, Zip, Email, Phone, Fax, URL, Description, & Notes. Appreciate your troubleshooting. Thanks. |
|||
|
Have you verified that each of the boxes has a Name specified on the Names tab of the Form Script dialog box? And that the case of the name exactly matches that shown in the script?
That's the only possibility I can think of, since the code for each of your boxes seems to be identical. |
||||
|
Yes, I did check the box names & case. Thanks.
|
||||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|

