For the lines, it might make sense to leave them off or use a script to remove the underline once a field is filled in. A custom validation script for such a text field might be:
// Custom validation script for a text field
event.target.strokeColor = event.value ? color.transparent : color.black;
This assumes the border style is set to underline.
Your code is for Web browsers. You can't use the code in Acrobat.