von luuuusss » Mo 12. Okt 2015, 20:34
Hi, i'm creating a form with the hiperref package and have a problem with defining default options for choice menus. It worked out perfectly for TextFields, but not for ChoiceMenu. Can somebody give me an advice how to set global options for ChoiceMenu please?
\documentclass{article}
\usepackage{xcolor}
\usepackage[
pdftex, colorlinks=true,
pdftitle={Mustervertrag Gastaufenthalt}, pdfauthor={Servicezentrum Forschung},
pdfpagemode=UseNone, pdfstartview=FitH,
pagebackref, pdfhighlight={/N}
]{hyperref}
\usepackage[pdftex]{insdljs}
\begin{insDLJS}{gendJS}{gender switch}
function GenderSwitch(myField){var choicefields = ['smain','u1','u2']; var src = this.getField(myField); if(src.value == 'f'){i = 1;} else{i = 0;} for(j = 0; j < choicefields.length ; j++){var f = this.getField(choicefields[j]);f.currentValueIndices = [i];} }
\end{insDLJS}
\begin{document}
\begin{Form}
\renewcommand*{\DefaultOptionsofText}{print, combo, bordercolor={green},
borderstyle=U, height=0.9em, width=\linewidth,
borderwidth=0, donotscroll=true, multiline=true}
\TextField[name={inst} format={var f = this.getField('inst');f.textFont = 'Verdana';}, default={\unexpanded{}}]{}
\ChoiceMenu[menulength=1,bordercolor={white}, width=6cm, combo, name={smain}, default=f,format={var f = this.getField('smain');f.textFont = 'Verdana';},onblur={
GenderSwitch('smain');
}, borderwidth=0]{}{{Gastwissenschaftler} = m, {Gastwissenschaftlerin} = f}
\ChoiceMenu[menulength=1,bordercolor={white}, combo, name={u1}, height =0.9em, default=f,format={var f = this.getField('u1');f.textFont = 'Verdana';},onblur={
GenderSwitch('u1');
}, borderwidth=0]{}{{Der Unternehmer} = m, {Die Unternehmerin} = f}
\end{Form}
\end{document}
[/code]
Hi, i'm creating a form with the hiperref package and have a problem with defining default options for choice menus. It worked out perfectly for TextFields, but not for ChoiceMenu. Can somebody give me an advice how to set global options for ChoiceMenu please?
[code]
\documentclass{article}
\usepackage{xcolor}
\usepackage[
pdftex, colorlinks=true,
pdftitle={Mustervertrag Gastaufenthalt}, pdfauthor={Servicezentrum Forschung},
pdfpagemode=UseNone, pdfstartview=FitH,
pagebackref, pdfhighlight={/N}
]{hyperref}
\usepackage[pdftex]{insdljs}
\begin{insDLJS}{gendJS}{gender switch}
function GenderSwitch(myField){var choicefields = ['smain','u1','u2']; var src = this.getField(myField); if(src.value == 'f'){i = 1;} else{i = 0;} for(j = 0; j < choicefields.length ; j++){var f = this.getField(choicefields[j]);f.currentValueIndices = [i];} }
\end{insDLJS}
\begin{document}
\begin{Form}
\renewcommand*{\DefaultOptionsofText}{print, combo, bordercolor={green},
borderstyle=U, height=0.9em, width=\linewidth,
borderwidth=0, donotscroll=true, multiline=true}
\TextField[name={inst} format={var f = this.getField('inst');f.textFont = 'Verdana';}, default={\unexpanded{}}]{}
\ChoiceMenu[menulength=1,bordercolor={white}, width=6cm, combo, name={smain}, default=f,format={var f = this.getField('smain');f.textFont = 'Verdana';},onblur={
GenderSwitch('smain');
}, borderwidth=0]{}{{Gastwissenschaftler} = m, {Gastwissenschaftlerin} = f}
\ChoiceMenu[menulength=1,bordercolor={white}, combo, name={u1}, height =0.9em, default=f,format={var f = this.getField('u1');f.textFont = 'Verdana';},onblur={
GenderSwitch('u1');
}, borderwidth=0]{}{{Der Unternehmer} = m, {Die Unternehmerin} = f}
\end{Form}
\end{document}
[/code][/code]