Copy link to clipboard
Copied
Good afternoon,
This may not belong here, for the reason that I'm using the Foxit PhantomPDF editor, but oh well, I'll give it a shot.
I was wondering if anybody had a solution for putting text in a field that is set to the Format style "Special?"
Say I was making a form and wanted to have the word "Phone Number" in the box, but disappear when the user begins typing. But still use the phone number Special qualities?
Edit: just saw I can attach files. Thought it might help.
My method (hybrid stolen from the internet) for all the Custom fields was easy - below - but I can't figure a way to do it with phone numbers/emails/numbers (prices). Its just super convienent to have the drop-down date picker and the auto price formatting and phone number formatting and stuff like that. I was thinking it would be doable with the Focus related scripts, but I can't figure it out.
Thank you very much for your time.
----------------------
// Custom Format script for text field
if (!event.value) {
event.value = event.target.name;
event.target.display = display.noPrint;
} else {
event.target.display = display.visible;
}
--------------------------------------------
// On Focus script:
if (event.target.value==event.target.defaultValue) {
event.target.value = "";
event.target.textSize = 8;
event.target.alignment = "left";
event.target.textColor = color.black;
}
----------------------------------------------------------
// On Blur script:
if (event.target.value=="") {
event.target.value = event.target.defaultValue;
event.target.textSize = 6;
event.target.alignment = "center";
event.target.textColor = color.ltGray;
}
--------------------------------------
Attached is an example of what I'd like accomplished. If you write in any of the "Custom" format boxes, it will auto align left and change the font color/size. But if you leave it blank, it just goes back to the Custom Format text, in this case event.target.name. I know its unnecessary, but a lot of the other boxes on the form required specific instructions, so I'd like to have the "ghost text" on all of them.
Thank you, once more.
Copy link to clipboard
Copied
You can't combine this method with the built-in Format settings, unless your "ghost text" adheres to the format allowed. For example, you can use something like "(000) 000-0000" as the ghost text of a phone field. If you want to use text that doesn't follow the allowed pattern you will need to write your own custom Format, and possibly Keystroke and Validation, script to accommodate for it.
I would recommend you use a tooltip, instead, or add a bit of static text next to each field.
Copy link to clipboard
Copied
Thank you very much. I kind of assumed I'd have to follow the formatting stlye for the pre-set Formats. Was just hopeful that maybe I was missing something.
Thank you, once more.