Copy link to clipboard
Copied
My client wants the ghost text to be light grey and centred, while the enter data to the black and left aligned.
I understand how to enter the default text and change the colour for the two but not alignment.
Here what I have
// On Focus script:
if (event.target.value==event.target.defaultValue) {
event.target.value = "";
event.target.textColor = color.black;
event.target.alignment = 0
}
// On Blur script:
if (event.target.value=="") {
event.target.value = event.target.defaultValue;
event.target.textColor = color.ltGray;
event.target.alignment = 1
}
Copy link to clipboard
Copied
alignment is "left", "center", or "right".
Copy link to clipboard
Copied
Bernd,
i adjusted it to left and center but it still not adjusting the alignment?
do i have event.target.alignment is right or should it be event.target.align ?
// On Focus script:
if (event.target.value==event.target.defaultValue) {
event.target.value = "";
event.target.textColor = color.black;
event.target.alignment = left
}
// On Blur script:
if (event.target.value=="") {
event.target.value = event.target.defaultValue;
event.target.textColor = color.ltGray;
event.target.alignment = center
}
Copy link to clipboard
Copied
Error i got
Exception in line 5 of function top_level, script AcroForm:First:Annot1:OnFocus:Action1
ReferenceError: left is not defined
5:AcroForm:First:Annot1:OnFocus:Action1Exception in line 5 of function top_level, script AcroForm:First:Annot1:OnBlur:Action1
ReferenceError: center is not defined
5:AcroForm:First:Annot1:OnBlur:Action1Exception in line 5 of function top_level, script AcroForm:First:Annot1:OnFocus:Action1
ReferenceError: left is not defined
5:AcroForm:First:Annot1:OnFocus:Action1
Copy link to clipboard
Copied
Figured it out sorry - spelling mistake and noob coding error
// On Focus script:
if (event.target.value==event.target.defaultValue) {
event.target.value = "";
event.target.textColor = color.black;
event.target.alignment = "left";
}
// On Blur script:
if (event.target.value=="") {
event.target.value = event.target.defaultValue;
event.target.textColor = color.ltGray;
event.target.alignment = "center";
}