How do I use a radio button to enable a image
i'm trying figure out how use radio button enable banner/background image guess question 2 fold:
1. how create background image?
2. how use radio button such when = yes, background image appears.
thanks!
hey there,
the first methos comes mind me use formvariable keep track of background visibility, have image in readonly image field on master page. after that, use little javascript wire up.
how to:
add form variable form:
- file, form properties
- click "variables" tab
- click + button
- enter variable name (i.e. backgroundvisibility)
- set value "hidden" (without quotes)
add background master page:
- click "master page" tab above form (nevt "design view tab)
- if "master page" tab isn't visible, right click on gray area right of tabs, , make suer "master pages" checked off in contect menu appears.
- insert image field , resize area want background image fill
- note* make sure use image field, not image. image fields let use scripts, images don't.
- format image field desired (i.e. remove caption, add border, etc.)
- select image use background, setting url field in image object properties.
- check "embed image data" check box below url in image object properties.
- add initize script (javascript) image field:
this.access = "readonly";
** note camel case used in "readonly" case sensitive.
- add layout:ready script (javascript) image field:
this.presence = backgroundvisibility.value;
** note backgroundvisibility should same name of variable added in last step.
wire via script:
- add check box actual form (not masterpage)
- add change script check box
backgroundvisibility.value = this.rawvalue == 1 ? "visible" : "hidden";
** again, backgroundvisibility should same name used form variable. above script uses ternary operator... similar condensed if/then/else
i know looks lot of work, that's because being specific. in actuality, it's form variable, image field, check box , 3 one-line scripts. simple.
let me know if have issues, or if didn't explain enough.
-scott
note*** realized asked radio button, not check box... above still works, long "yes" given value of 1 on binding tab of radio group.
note second*** added step first bit... specifically, setting form variable value "hidden" default state of background image.
More discussions in LiveCycle Designer
adobe
Comments
Post a Comment