Invulvelden pdf - 'knopinfo' in het veld zelf?

Pagina: 1
Acties:

Onderwerpen

Vraag


Acties:
  • 0 Henk 'm!

  • Joeridev
  • Registratie: Juli 2009
  • Laatst online: 09:15
Beste tweakers,

Ik heb een vraagje: ik probeer een pdf-formulier te maken met invulvelden waarin de uitleg ('knopinfo', normaal gesproken alleen weergegeven als de cursor korte tijd op het veld staat) als tijdelijke tekst binnen in het invulveld zichtbaar is. Het is de bedoeling dat deze tekst verdwijnt zodra je op het veld klikt. Gek genoeg kan ik hierover niks vinden binnen de handleiding of op Google. Is dit mogelijk?

Groet,

Joeri

Beste antwoord (via Joeridev op 13-01-2020 12:48)


  • F_J_K
  • Registratie: Juni 2001
  • Niet online

F_J_K

Moderator CSA/PB

Front verplichte underscores

Relevant: welk tool gebruik je om de forms te maken?

Dat kan met een script, bijvoorbeeld zoeken bij google naar 'pdf explanation in text field' -> https://answers.acrobatus...-text-fields-q303265.aspx ->
Here's my way of doing it. Others might prefer a different method... Set the field's default value to the text you want to display by default and then apply the following code to the field's On Focus and On Blur events, resp.:
// On Focus script:
if (event.target.value==event.target.defaultValue) {
    event.target.value = "";
    event.target.textColor = color.black;
}

// On Blur script:
if (event.target.value=="") {
    event.target.value = event.target.defaultValue;
    event.target.textColor = color.ltGray;
}

When the user clicks into the field, the default value will disappear and the field will be blank. If they don't enter anything (or delete what was there) and then exit the field, the default value will be shown once more.

The third line of code in each block is an optional feature that will change the field's text color to a light gray when it shows the default value or to black when an actual value is filled-in by the user.

[ Voor 4% gewijzigd door F_J_K op 13-01-2020 12:34 . Reden: Google termen er bij, mogelijk kan je er meer / handigere manieren vinden ]

'Multiple exclamation marks,' he went on, shaking his head, 'are a sure sign of a diseased mind' (Terry Pratchett, Eric)

Alle reacties


Acties:
  • Beste antwoord
  • 0 Henk 'm!

  • F_J_K
  • Registratie: Juni 2001
  • Niet online

F_J_K

Moderator CSA/PB

Front verplichte underscores

Relevant: welk tool gebruik je om de forms te maken?

Dat kan met een script, bijvoorbeeld zoeken bij google naar 'pdf explanation in text field' -> https://answers.acrobatus...-text-fields-q303265.aspx ->
Here's my way of doing it. Others might prefer a different method... Set the field's default value to the text you want to display by default and then apply the following code to the field's On Focus and On Blur events, resp.:
// On Focus script:
if (event.target.value==event.target.defaultValue) {
    event.target.value = "";
    event.target.textColor = color.black;
}

// On Blur script:
if (event.target.value=="") {
    event.target.value = event.target.defaultValue;
    event.target.textColor = color.ltGray;
}

When the user clicks into the field, the default value will disappear and the field will be blank. If they don't enter anything (or delete what was there) and then exit the field, the default value will be shown once more.

The third line of code in each block is an optional feature that will change the field's text color to a light gray when it shows the default value or to black when an actual value is filled-in by the user.

[ Voor 4% gewijzigd door F_J_K op 13-01-2020 12:34 . Reden: Google termen er bij, mogelijk kan je er meer / handigere manieren vinden ]

'Multiple exclamation marks,' he went on, shaking his head, 'are a sure sign of a diseased mind' (Terry Pratchett, Eric)


Acties:
  • +1 Henk 'm!

  • g0tanks
  • Registratie: Oktober 2008
  • Laatst online: 22:07

g0tanks

Moderator CSA
In Adobe Acrobat (bij prepare form) kan je dit soort van nabootsen door in de eigenschappen van een veld aan te geven dat 'on focus' het veld wordt leeggemaakt. Dit werkt niet helemaal lekker omdat je niet kan instellen dat het alleen de eerste keer gebeurt. Als je dus iets hebt ingevuld en later het weer wil wijzigen zal het veld opnieuw worden geleegd.

Afbeeldingslocatie: https://tweakers.net/ext/f/3NASlCtWQQ1T0ltOZt263S8J/full.png

Ultrawide gaming setup: AMD Ryzen 7 2700X | NVIDIA GeForce RTX 2080 | Dell Alienware AW3418DW


Acties:
  • +1 Henk 'm!

  • Joeridev
  • Registratie: Juli 2009
  • Laatst online: 09:15
Dank jullie wel! Dan is het script van F_J_K de beste optie, omdat het daar wél alleen de eerste keer gebeurt. Als ik iets invul en later het veld weer aanklik, dan blijft de ingevulde tekst staan.

Nogmaals dank!