Hyperref TextField – How to implement an hyperref action WITHOUT pushbutton












2















How are the hyperref package options onchange and onkeypress used?



In the following example, which transfers the input-text to the output-text, only the pushbutton using the onclick -option work.... but not the onchange option within the textfield.



I would like to obtain that the input text is copied to the output text field immediately, if the input text field changes, WITHOUT using the push button.



documentclass[20pt,a4paper]{article}

usepackage{xcolor}
usepackage{hyperref}

%% Short hand commands
newcommand{textforlabel}[2]{%
TextField[name={#1}, value={#2}, width=9em,align=2,%
bordercolor={0.990 .980 .85},%
readonly=true]{}%
}%

newcommand{heading}[1]{textsc{#1}}

%% document
begin{document}
begin{Form}

%% Input
heading{Input}
\
\
textforlabel{l01}{Input:}
TextField[name=input1,onchange={%
var datastring1=this.getField("input1").value;
this.getField("output1").value=datastring1;%
}%
,width=2in, bordercolor={0.650 .790 .94}]{}%
\
%% Push button
PushButton[name=button1,onclick={%
var datastring1=this.getField("input1").value;
this.getField("output1").value=datastring1;%
}%
,bordercolor={0 0 0}]{To Output}
\

%% Output
heading{Output}
\
\
textforlabel{l02}{Output:}
TextField[name=output1,width=2in,%
bordercolor={0.650 .790 .94},readonly=true]{}

end{Form}
end{document}









share|improve this question

























  • pdflatex issues a message: "Package hyperref Warning: HTML field option 'onchange' is ignored on line 28". Possibly this functionality is not provided for PDF forms, and only for HTML forms (which you can make with htlatex)?

    – Marijn
    Mar 30 '17 at 22:21


















2















How are the hyperref package options onchange and onkeypress used?



In the following example, which transfers the input-text to the output-text, only the pushbutton using the onclick -option work.... but not the onchange option within the textfield.



I would like to obtain that the input text is copied to the output text field immediately, if the input text field changes, WITHOUT using the push button.



documentclass[20pt,a4paper]{article}

usepackage{xcolor}
usepackage{hyperref}

%% Short hand commands
newcommand{textforlabel}[2]{%
TextField[name={#1}, value={#2}, width=9em,align=2,%
bordercolor={0.990 .980 .85},%
readonly=true]{}%
}%

newcommand{heading}[1]{textsc{#1}}

%% document
begin{document}
begin{Form}

%% Input
heading{Input}
\
\
textforlabel{l01}{Input:}
TextField[name=input1,onchange={%
var datastring1=this.getField("input1").value;
this.getField("output1").value=datastring1;%
}%
,width=2in, bordercolor={0.650 .790 .94}]{}%
\
%% Push button
PushButton[name=button1,onclick={%
var datastring1=this.getField("input1").value;
this.getField("output1").value=datastring1;%
}%
,bordercolor={0 0 0}]{To Output}
\

%% Output
heading{Output}
\
\
textforlabel{l02}{Output:}
TextField[name=output1,width=2in,%
bordercolor={0.650 .790 .94},readonly=true]{}

end{Form}
end{document}









share|improve this question

























  • pdflatex issues a message: "Package hyperref Warning: HTML field option 'onchange' is ignored on line 28". Possibly this functionality is not provided for PDF forms, and only for HTML forms (which you can make with htlatex)?

    – Marijn
    Mar 30 '17 at 22:21
















2












2








2








How are the hyperref package options onchange and onkeypress used?



In the following example, which transfers the input-text to the output-text, only the pushbutton using the onclick -option work.... but not the onchange option within the textfield.



I would like to obtain that the input text is copied to the output text field immediately, if the input text field changes, WITHOUT using the push button.



documentclass[20pt,a4paper]{article}

usepackage{xcolor}
usepackage{hyperref}

%% Short hand commands
newcommand{textforlabel}[2]{%
TextField[name={#1}, value={#2}, width=9em,align=2,%
bordercolor={0.990 .980 .85},%
readonly=true]{}%
}%

newcommand{heading}[1]{textsc{#1}}

%% document
begin{document}
begin{Form}

%% Input
heading{Input}
\
\
textforlabel{l01}{Input:}
TextField[name=input1,onchange={%
var datastring1=this.getField("input1").value;
this.getField("output1").value=datastring1;%
}%
,width=2in, bordercolor={0.650 .790 .94}]{}%
\
%% Push button
PushButton[name=button1,onclick={%
var datastring1=this.getField("input1").value;
this.getField("output1").value=datastring1;%
}%
,bordercolor={0 0 0}]{To Output}
\

%% Output
heading{Output}
\
\
textforlabel{l02}{Output:}
TextField[name=output1,width=2in,%
bordercolor={0.650 .790 .94},readonly=true]{}

end{Form}
end{document}









share|improve this question
















How are the hyperref package options onchange and onkeypress used?



In the following example, which transfers the input-text to the output-text, only the pushbutton using the onclick -option work.... but not the onchange option within the textfield.



I would like to obtain that the input text is copied to the output text field immediately, if the input text field changes, WITHOUT using the push button.



documentclass[20pt,a4paper]{article}

usepackage{xcolor}
usepackage{hyperref}

%% Short hand commands
newcommand{textforlabel}[2]{%
TextField[name={#1}, value={#2}, width=9em,align=2,%
bordercolor={0.990 .980 .85},%
readonly=true]{}%
}%

newcommand{heading}[1]{textsc{#1}}

%% document
begin{document}
begin{Form}

%% Input
heading{Input}
\
\
textforlabel{l01}{Input:}
TextField[name=input1,onchange={%
var datastring1=this.getField("input1").value;
this.getField("output1").value=datastring1;%
}%
,width=2in, bordercolor={0.650 .790 .94}]{}%
\
%% Push button
PushButton[name=button1,onclick={%
var datastring1=this.getField("input1").value;
this.getField("output1").value=datastring1;%
}%
,bordercolor={0 0 0}]{To Output}
\

%% Output
heading{Output}
\
\
textforlabel{l02}{Output:}
TextField[name=output1,width=2in,%
bordercolor={0.650 .790 .94},readonly=true]{}

end{Form}
end{document}






hyperref






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 30 '17 at 16:59









Sebastiano

9,50741857




9,50741857










asked Mar 30 '17 at 15:26









JacobHerJacobHer

111




111













  • pdflatex issues a message: "Package hyperref Warning: HTML field option 'onchange' is ignored on line 28". Possibly this functionality is not provided for PDF forms, and only for HTML forms (which you can make with htlatex)?

    – Marijn
    Mar 30 '17 at 22:21





















  • pdflatex issues a message: "Package hyperref Warning: HTML field option 'onchange' is ignored on line 28". Possibly this functionality is not provided for PDF forms, and only for HTML forms (which you can make with htlatex)?

    – Marijn
    Mar 30 '17 at 22:21



















pdflatex issues a message: "Package hyperref Warning: HTML field option 'onchange' is ignored on line 28". Possibly this functionality is not provided for PDF forms, and only for HTML forms (which you can make with htlatex)?

– Marijn
Mar 30 '17 at 22:21







pdflatex issues a message: "Package hyperref Warning: HTML field option 'onchange' is ignored on line 28". Possibly this functionality is not provided for PDF forms, and only for HTML forms (which you can make with htlatex)?

– Marijn
Mar 30 '17 at 22:21












2 Answers
2






active

oldest

votes


















1














You can use the keystroke option of TextField and evaluate the event.value property in the JavaScript to set the output field's value.



Unfortunately, event.value contains only the value that was known before input1 received the keystroke. You have to end the input by hitting "Enter" in order to also get the last key typed in:



documentclass[20pt,a4paper]{article}

usepackage{xcolor}
usepackage{hyperref}

%% Short hand commands
newcommand{textforlabel}[2]{%
TextField[name={#1}, value={#2}, width=9em,align=2,%
bordercolor={0.990 .980 .85},%
readonly=true]{}%
}%

newcommand{heading}[1]{textsc{#1}}

%% document
begin{document}
begin{Form}

%% Input
heading{Input}
\
\
textforlabel{l01}{Input:}
TextField[name=input1,keystroke={%
% var datastring1=this.getField("input1").value;
% this.getField("output1").value=datastring1;%
this.getField("output1").value=event.value;
}%
,width=2in, bordercolor={0.650 .790 .94}]{}%
\
%%% Push button
%PushButton[name=button1,onclick={%
% var datastring1=this.getField("input1").value;
% this.getField("output1").value=datastring1;%
% }%
% ,bordercolor={0 0 0}]{To Output}
% \

%% Output
heading{Output}
\
\
textforlabel{l02}{Output:}
TextField[name=output1,width=2in,%
bordercolor={0.650 .790 .94},readonly=true]{}

end{Form}
end{document}





share|improve this answer





















  • 1





    Thanks. Very Helpful. The restriction that the last letter is not transfered, will be difficult to overcome as I see. I don t think that it is possible.

    – JacobHer
    Mar 31 '17 at 13:47





















0














Would this be enough for you ? It is not completely instaneous but changes the whole answer directly. You have to press tab or go in another field to implement the JS command, similarly as with Keystroke, which does not implement the last letter until after the event.



    documentclass[20pt,a4paper]{article}

usepackage{xcolor}
usepackage{hyperref}

%% Short hand commands
newcommand{textforlabel}[2]{%
TextField[name={#1}, value={#2}, width=9em,align=2,%
bordercolor={0.990 .980 .85},%
readonly=true]{}%
}%

newcommand{heading}[1]{textsc{#1}}

%% document
begin{document}
begin{Form}

heading{Input 1}
\
\
textforlabel{l01}{Input 1:}
TextField[name=input1,width=2in, bordercolor={0.650 .790 .94}]{}%
\
%% Push button
PushButton[name=button1,onclick={%
var datastring1=this.getField("input1").value;
this.getField("output1").value=datastring1;%
}%
,bordercolor={0 0 0}]{To Output}
\

%% Output
heading{Output 1}
\
\
textforlabel{l02}{Output1:}
TextField[name=output1,width=2in,%
bordercolor={0.650 .790 .94},readonly=true]{}

vspace{40pt}

%% Input 2
heading{Input 2}
\
\
textforlabel{l03}{Input 2:}
TextField[
name=input2,
width=2in,
bordercolor={0.650 .790 .94}]{}
\

%% Output 2
heading{Output 2}
\
\
textforlabel{l04}{Output:}
TextField[
name=output2,
width=2in,
bordercolor={0.650 .790 .94},
readonly=true,
calculate = {%
event.value = this.getField("input2").value;
}
]{}
end{Form}
end{document}





share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f361269%2fhyperref-textfield-how-to-implement-an-hyperref-action-without-pushbutton%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    You can use the keystroke option of TextField and evaluate the event.value property in the JavaScript to set the output field's value.



    Unfortunately, event.value contains only the value that was known before input1 received the keystroke. You have to end the input by hitting "Enter" in order to also get the last key typed in:



    documentclass[20pt,a4paper]{article}

    usepackage{xcolor}
    usepackage{hyperref}

    %% Short hand commands
    newcommand{textforlabel}[2]{%
    TextField[name={#1}, value={#2}, width=9em,align=2,%
    bordercolor={0.990 .980 .85},%
    readonly=true]{}%
    }%

    newcommand{heading}[1]{textsc{#1}}

    %% document
    begin{document}
    begin{Form}

    %% Input
    heading{Input}
    \
    \
    textforlabel{l01}{Input:}
    TextField[name=input1,keystroke={%
    % var datastring1=this.getField("input1").value;
    % this.getField("output1").value=datastring1;%
    this.getField("output1").value=event.value;
    }%
    ,width=2in, bordercolor={0.650 .790 .94}]{}%
    \
    %%% Push button
    %PushButton[name=button1,onclick={%
    % var datastring1=this.getField("input1").value;
    % this.getField("output1").value=datastring1;%
    % }%
    % ,bordercolor={0 0 0}]{To Output}
    % \

    %% Output
    heading{Output}
    \
    \
    textforlabel{l02}{Output:}
    TextField[name=output1,width=2in,%
    bordercolor={0.650 .790 .94},readonly=true]{}

    end{Form}
    end{document}





    share|improve this answer





















    • 1





      Thanks. Very Helpful. The restriction that the last letter is not transfered, will be difficult to overcome as I see. I don t think that it is possible.

      – JacobHer
      Mar 31 '17 at 13:47


















    1














    You can use the keystroke option of TextField and evaluate the event.value property in the JavaScript to set the output field's value.



    Unfortunately, event.value contains only the value that was known before input1 received the keystroke. You have to end the input by hitting "Enter" in order to also get the last key typed in:



    documentclass[20pt,a4paper]{article}

    usepackage{xcolor}
    usepackage{hyperref}

    %% Short hand commands
    newcommand{textforlabel}[2]{%
    TextField[name={#1}, value={#2}, width=9em,align=2,%
    bordercolor={0.990 .980 .85},%
    readonly=true]{}%
    }%

    newcommand{heading}[1]{textsc{#1}}

    %% document
    begin{document}
    begin{Form}

    %% Input
    heading{Input}
    \
    \
    textforlabel{l01}{Input:}
    TextField[name=input1,keystroke={%
    % var datastring1=this.getField("input1").value;
    % this.getField("output1").value=datastring1;%
    this.getField("output1").value=event.value;
    }%
    ,width=2in, bordercolor={0.650 .790 .94}]{}%
    \
    %%% Push button
    %PushButton[name=button1,onclick={%
    % var datastring1=this.getField("input1").value;
    % this.getField("output1").value=datastring1;%
    % }%
    % ,bordercolor={0 0 0}]{To Output}
    % \

    %% Output
    heading{Output}
    \
    \
    textforlabel{l02}{Output:}
    TextField[name=output1,width=2in,%
    bordercolor={0.650 .790 .94},readonly=true]{}

    end{Form}
    end{document}





    share|improve this answer





















    • 1





      Thanks. Very Helpful. The restriction that the last letter is not transfered, will be difficult to overcome as I see. I don t think that it is possible.

      – JacobHer
      Mar 31 '17 at 13:47
















    1












    1








    1







    You can use the keystroke option of TextField and evaluate the event.value property in the JavaScript to set the output field's value.



    Unfortunately, event.value contains only the value that was known before input1 received the keystroke. You have to end the input by hitting "Enter" in order to also get the last key typed in:



    documentclass[20pt,a4paper]{article}

    usepackage{xcolor}
    usepackage{hyperref}

    %% Short hand commands
    newcommand{textforlabel}[2]{%
    TextField[name={#1}, value={#2}, width=9em,align=2,%
    bordercolor={0.990 .980 .85},%
    readonly=true]{}%
    }%

    newcommand{heading}[1]{textsc{#1}}

    %% document
    begin{document}
    begin{Form}

    %% Input
    heading{Input}
    \
    \
    textforlabel{l01}{Input:}
    TextField[name=input1,keystroke={%
    % var datastring1=this.getField("input1").value;
    % this.getField("output1").value=datastring1;%
    this.getField("output1").value=event.value;
    }%
    ,width=2in, bordercolor={0.650 .790 .94}]{}%
    \
    %%% Push button
    %PushButton[name=button1,onclick={%
    % var datastring1=this.getField("input1").value;
    % this.getField("output1").value=datastring1;%
    % }%
    % ,bordercolor={0 0 0}]{To Output}
    % \

    %% Output
    heading{Output}
    \
    \
    textforlabel{l02}{Output:}
    TextField[name=output1,width=2in,%
    bordercolor={0.650 .790 .94},readonly=true]{}

    end{Form}
    end{document}





    share|improve this answer















    You can use the keystroke option of TextField and evaluate the event.value property in the JavaScript to set the output field's value.



    Unfortunately, event.value contains only the value that was known before input1 received the keystroke. You have to end the input by hitting "Enter" in order to also get the last key typed in:



    documentclass[20pt,a4paper]{article}

    usepackage{xcolor}
    usepackage{hyperref}

    %% Short hand commands
    newcommand{textforlabel}[2]{%
    TextField[name={#1}, value={#2}, width=9em,align=2,%
    bordercolor={0.990 .980 .85},%
    readonly=true]{}%
    }%

    newcommand{heading}[1]{textsc{#1}}

    %% document
    begin{document}
    begin{Form}

    %% Input
    heading{Input}
    \
    \
    textforlabel{l01}{Input:}
    TextField[name=input1,keystroke={%
    % var datastring1=this.getField("input1").value;
    % this.getField("output1").value=datastring1;%
    this.getField("output1").value=event.value;
    }%
    ,width=2in, bordercolor={0.650 .790 .94}]{}%
    \
    %%% Push button
    %PushButton[name=button1,onclick={%
    % var datastring1=this.getField("input1").value;
    % this.getField("output1").value=datastring1;%
    % }%
    % ,bordercolor={0 0 0}]{To Output}
    % \

    %% Output
    heading{Output}
    \
    \
    textforlabel{l02}{Output:}
    TextField[name=output1,width=2in,%
    bordercolor={0.650 .790 .94},readonly=true]{}

    end{Form}
    end{document}






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 31 '17 at 11:04

























    answered Mar 31 '17 at 10:44









    AlexGAlexG

    32.7k479145




    32.7k479145








    • 1





      Thanks. Very Helpful. The restriction that the last letter is not transfered, will be difficult to overcome as I see. I don t think that it is possible.

      – JacobHer
      Mar 31 '17 at 13:47
















    • 1





      Thanks. Very Helpful. The restriction that the last letter is not transfered, will be difficult to overcome as I see. I don t think that it is possible.

      – JacobHer
      Mar 31 '17 at 13:47










    1




    1





    Thanks. Very Helpful. The restriction that the last letter is not transfered, will be difficult to overcome as I see. I don t think that it is possible.

    – JacobHer
    Mar 31 '17 at 13:47







    Thanks. Very Helpful. The restriction that the last letter is not transfered, will be difficult to overcome as I see. I don t think that it is possible.

    – JacobHer
    Mar 31 '17 at 13:47













    0














    Would this be enough for you ? It is not completely instaneous but changes the whole answer directly. You have to press tab or go in another field to implement the JS command, similarly as with Keystroke, which does not implement the last letter until after the event.



        documentclass[20pt,a4paper]{article}

    usepackage{xcolor}
    usepackage{hyperref}

    %% Short hand commands
    newcommand{textforlabel}[2]{%
    TextField[name={#1}, value={#2}, width=9em,align=2,%
    bordercolor={0.990 .980 .85},%
    readonly=true]{}%
    }%

    newcommand{heading}[1]{textsc{#1}}

    %% document
    begin{document}
    begin{Form}

    heading{Input 1}
    \
    \
    textforlabel{l01}{Input 1:}
    TextField[name=input1,width=2in, bordercolor={0.650 .790 .94}]{}%
    \
    %% Push button
    PushButton[name=button1,onclick={%
    var datastring1=this.getField("input1").value;
    this.getField("output1").value=datastring1;%
    }%
    ,bordercolor={0 0 0}]{To Output}
    \

    %% Output
    heading{Output 1}
    \
    \
    textforlabel{l02}{Output1:}
    TextField[name=output1,width=2in,%
    bordercolor={0.650 .790 .94},readonly=true]{}

    vspace{40pt}

    %% Input 2
    heading{Input 2}
    \
    \
    textforlabel{l03}{Input 2:}
    TextField[
    name=input2,
    width=2in,
    bordercolor={0.650 .790 .94}]{}
    \

    %% Output 2
    heading{Output 2}
    \
    \
    textforlabel{l04}{Output:}
    TextField[
    name=output2,
    width=2in,
    bordercolor={0.650 .790 .94},
    readonly=true,
    calculate = {%
    event.value = this.getField("input2").value;
    }
    ]{}
    end{Form}
    end{document}





    share|improve this answer




























      0














      Would this be enough for you ? It is not completely instaneous but changes the whole answer directly. You have to press tab or go in another field to implement the JS command, similarly as with Keystroke, which does not implement the last letter until after the event.



          documentclass[20pt,a4paper]{article}

      usepackage{xcolor}
      usepackage{hyperref}

      %% Short hand commands
      newcommand{textforlabel}[2]{%
      TextField[name={#1}, value={#2}, width=9em,align=2,%
      bordercolor={0.990 .980 .85},%
      readonly=true]{}%
      }%

      newcommand{heading}[1]{textsc{#1}}

      %% document
      begin{document}
      begin{Form}

      heading{Input 1}
      \
      \
      textforlabel{l01}{Input 1:}
      TextField[name=input1,width=2in, bordercolor={0.650 .790 .94}]{}%
      \
      %% Push button
      PushButton[name=button1,onclick={%
      var datastring1=this.getField("input1").value;
      this.getField("output1").value=datastring1;%
      }%
      ,bordercolor={0 0 0}]{To Output}
      \

      %% Output
      heading{Output 1}
      \
      \
      textforlabel{l02}{Output1:}
      TextField[name=output1,width=2in,%
      bordercolor={0.650 .790 .94},readonly=true]{}

      vspace{40pt}

      %% Input 2
      heading{Input 2}
      \
      \
      textforlabel{l03}{Input 2:}
      TextField[
      name=input2,
      width=2in,
      bordercolor={0.650 .790 .94}]{}
      \

      %% Output 2
      heading{Output 2}
      \
      \
      textforlabel{l04}{Output:}
      TextField[
      name=output2,
      width=2in,
      bordercolor={0.650 .790 .94},
      readonly=true,
      calculate = {%
      event.value = this.getField("input2").value;
      }
      ]{}
      end{Form}
      end{document}





      share|improve this answer


























        0












        0








        0







        Would this be enough for you ? It is not completely instaneous but changes the whole answer directly. You have to press tab or go in another field to implement the JS command, similarly as with Keystroke, which does not implement the last letter until after the event.



            documentclass[20pt,a4paper]{article}

        usepackage{xcolor}
        usepackage{hyperref}

        %% Short hand commands
        newcommand{textforlabel}[2]{%
        TextField[name={#1}, value={#2}, width=9em,align=2,%
        bordercolor={0.990 .980 .85},%
        readonly=true]{}%
        }%

        newcommand{heading}[1]{textsc{#1}}

        %% document
        begin{document}
        begin{Form}

        heading{Input 1}
        \
        \
        textforlabel{l01}{Input 1:}
        TextField[name=input1,width=2in, bordercolor={0.650 .790 .94}]{}%
        \
        %% Push button
        PushButton[name=button1,onclick={%
        var datastring1=this.getField("input1").value;
        this.getField("output1").value=datastring1;%
        }%
        ,bordercolor={0 0 0}]{To Output}
        \

        %% Output
        heading{Output 1}
        \
        \
        textforlabel{l02}{Output1:}
        TextField[name=output1,width=2in,%
        bordercolor={0.650 .790 .94},readonly=true]{}

        vspace{40pt}

        %% Input 2
        heading{Input 2}
        \
        \
        textforlabel{l03}{Input 2:}
        TextField[
        name=input2,
        width=2in,
        bordercolor={0.650 .790 .94}]{}
        \

        %% Output 2
        heading{Output 2}
        \
        \
        textforlabel{l04}{Output:}
        TextField[
        name=output2,
        width=2in,
        bordercolor={0.650 .790 .94},
        readonly=true,
        calculate = {%
        event.value = this.getField("input2").value;
        }
        ]{}
        end{Form}
        end{document}





        share|improve this answer













        Would this be enough for you ? It is not completely instaneous but changes the whole answer directly. You have to press tab or go in another field to implement the JS command, similarly as with Keystroke, which does not implement the last letter until after the event.



            documentclass[20pt,a4paper]{article}

        usepackage{xcolor}
        usepackage{hyperref}

        %% Short hand commands
        newcommand{textforlabel}[2]{%
        TextField[name={#1}, value={#2}, width=9em,align=2,%
        bordercolor={0.990 .980 .85},%
        readonly=true]{}%
        }%

        newcommand{heading}[1]{textsc{#1}}

        %% document
        begin{document}
        begin{Form}

        heading{Input 1}
        \
        \
        textforlabel{l01}{Input 1:}
        TextField[name=input1,width=2in, bordercolor={0.650 .790 .94}]{}%
        \
        %% Push button
        PushButton[name=button1,onclick={%
        var datastring1=this.getField("input1").value;
        this.getField("output1").value=datastring1;%
        }%
        ,bordercolor={0 0 0}]{To Output}
        \

        %% Output
        heading{Output 1}
        \
        \
        textforlabel{l02}{Output1:}
        TextField[name=output1,width=2in,%
        bordercolor={0.650 .790 .94},readonly=true]{}

        vspace{40pt}

        %% Input 2
        heading{Input 2}
        \
        \
        textforlabel{l03}{Input 2:}
        TextField[
        name=input2,
        width=2in,
        bordercolor={0.650 .790 .94}]{}
        \

        %% Output 2
        heading{Output 2}
        \
        \
        textforlabel{l04}{Output:}
        TextField[
        name=output2,
        width=2in,
        bordercolor={0.650 .790 .94},
        readonly=true,
        calculate = {%
        event.value = this.getField("input2").value;
        }
        ]{}
        end{Form}
        end{document}






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 17 at 16:37









        A.DuA.Du

        326




        326






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f361269%2fhyperref-textfield-how-to-implement-an-hyperref-action-without-pushbutton%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?