Entering value into webform text box with VBA works on screen, but data not actually entered into the text...











up vote
0
down vote

favorite












I have some code that works fine to enter data via Excel/VBA into webforms.



I have it working on other sites, but on this one site, the data is "entered" into the text box, as I can see it on screen.



But if I then click on the text box the data disappears. Likewise, if I click submit on the form, I get an error saying the text boxes are empty (even though, on screen, they are not).



As I say, the code I have works on other sites so it must be something about the site I am using.



FYI here's simplified code I am using, where IE is an Internet Explorer object:



IE.document.all("EntryField_hdn_547").Value = "My Name"


This is the URL of the form:
https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp



(you'll need to click through to the 3rd page, and click the "Employer" radio to see the text fields)



And this is the HTML of eg the above text entry box:



<input type="text" class="i" name="EntryField_hdn_547" tabindex="1469" aria-label="Name" style="text-align: left; vertical-align: middle; text-indent: 0px; padding: 0px 5.67px; height: 34.0157px; box-sizing: border-box; position: absolute; width: 566.93px;">


Can anyone help suggest a way to get the data to "stick" in the text boxes



(FYI I also have code to click the radio buttons, and that works fine)



Also, I tried this answer which seems very similar but still no joy:
Text entered into Webpage Search Box via Excel VBA is not detected when clicking Search button










share|improve this question






















  • Have you tried using selenium basic?
    – QHarr
    Nov 22 at 15:21










  • Not looked at that before. As I have a solution already working on other sites, I am hoping a simple tweak might get this working, rather than setting up a whole new system.
    – Jaspos
    Nov 22 at 16:03










  • A lot of java script is running here. I am afraid here no simple tweak will exist and it is not possible just simply set the attribute value from VBA code :(.
    – dee
    Nov 22 at 22:24

















up vote
0
down vote

favorite












I have some code that works fine to enter data via Excel/VBA into webforms.



I have it working on other sites, but on this one site, the data is "entered" into the text box, as I can see it on screen.



But if I then click on the text box the data disappears. Likewise, if I click submit on the form, I get an error saying the text boxes are empty (even though, on screen, they are not).



As I say, the code I have works on other sites so it must be something about the site I am using.



FYI here's simplified code I am using, where IE is an Internet Explorer object:



IE.document.all("EntryField_hdn_547").Value = "My Name"


This is the URL of the form:
https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp



(you'll need to click through to the 3rd page, and click the "Employer" radio to see the text fields)



And this is the HTML of eg the above text entry box:



<input type="text" class="i" name="EntryField_hdn_547" tabindex="1469" aria-label="Name" style="text-align: left; vertical-align: middle; text-indent: 0px; padding: 0px 5.67px; height: 34.0157px; box-sizing: border-box; position: absolute; width: 566.93px;">


Can anyone help suggest a way to get the data to "stick" in the text boxes



(FYI I also have code to click the radio buttons, and that works fine)



Also, I tried this answer which seems very similar but still no joy:
Text entered into Webpage Search Box via Excel VBA is not detected when clicking Search button










share|improve this question






















  • Have you tried using selenium basic?
    – QHarr
    Nov 22 at 15:21










  • Not looked at that before. As I have a solution already working on other sites, I am hoping a simple tweak might get this working, rather than setting up a whole new system.
    – Jaspos
    Nov 22 at 16:03










  • A lot of java script is running here. I am afraid here no simple tweak will exist and it is not possible just simply set the attribute value from VBA code :(.
    – dee
    Nov 22 at 22:24















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have some code that works fine to enter data via Excel/VBA into webforms.



I have it working on other sites, but on this one site, the data is "entered" into the text box, as I can see it on screen.



But if I then click on the text box the data disappears. Likewise, if I click submit on the form, I get an error saying the text boxes are empty (even though, on screen, they are not).



As I say, the code I have works on other sites so it must be something about the site I am using.



FYI here's simplified code I am using, where IE is an Internet Explorer object:



IE.document.all("EntryField_hdn_547").Value = "My Name"


This is the URL of the form:
https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp



(you'll need to click through to the 3rd page, and click the "Employer" radio to see the text fields)



And this is the HTML of eg the above text entry box:



<input type="text" class="i" name="EntryField_hdn_547" tabindex="1469" aria-label="Name" style="text-align: left; vertical-align: middle; text-indent: 0px; padding: 0px 5.67px; height: 34.0157px; box-sizing: border-box; position: absolute; width: 566.93px;">


Can anyone help suggest a way to get the data to "stick" in the text boxes



(FYI I also have code to click the radio buttons, and that works fine)



Also, I tried this answer which seems very similar but still no joy:
Text entered into Webpage Search Box via Excel VBA is not detected when clicking Search button










share|improve this question













I have some code that works fine to enter data via Excel/VBA into webforms.



I have it working on other sites, but on this one site, the data is "entered" into the text box, as I can see it on screen.



But if I then click on the text box the data disappears. Likewise, if I click submit on the form, I get an error saying the text boxes are empty (even though, on screen, they are not).



As I say, the code I have works on other sites so it must be something about the site I am using.



FYI here's simplified code I am using, where IE is an Internet Explorer object:



IE.document.all("EntryField_hdn_547").Value = "My Name"


This is the URL of the form:
https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp



(you'll need to click through to the 3rd page, and click the "Employer" radio to see the text fields)



And this is the HTML of eg the above text entry box:



<input type="text" class="i" name="EntryField_hdn_547" tabindex="1469" aria-label="Name" style="text-align: left; vertical-align: middle; text-indent: 0px; padding: 0px 5.67px; height: 34.0157px; box-sizing: border-box; position: absolute; width: 566.93px;">


Can anyone help suggest a way to get the data to "stick" in the text boxes



(FYI I also have code to click the radio buttons, and that works fine)



Also, I tried this answer which seems very similar but still no joy:
Text entered into Webpage Search Box via Excel VBA is not detected when clicking Search button







html vba webforms inputbox






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 at 15:19









Jaspos

48110




48110












  • Have you tried using selenium basic?
    – QHarr
    Nov 22 at 15:21










  • Not looked at that before. As I have a solution already working on other sites, I am hoping a simple tweak might get this working, rather than setting up a whole new system.
    – Jaspos
    Nov 22 at 16:03










  • A lot of java script is running here. I am afraid here no simple tweak will exist and it is not possible just simply set the attribute value from VBA code :(.
    – dee
    Nov 22 at 22:24




















  • Have you tried using selenium basic?
    – QHarr
    Nov 22 at 15:21










  • Not looked at that before. As I have a solution already working on other sites, I am hoping a simple tweak might get this working, rather than setting up a whole new system.
    – Jaspos
    Nov 22 at 16:03










  • A lot of java script is running here. I am afraid here no simple tweak will exist and it is not possible just simply set the attribute value from VBA code :(.
    – dee
    Nov 22 at 22:24


















Have you tried using selenium basic?
– QHarr
Nov 22 at 15:21




Have you tried using selenium basic?
– QHarr
Nov 22 at 15:21












Not looked at that before. As I have a solution already working on other sites, I am hoping a simple tweak might get this working, rather than setting up a whole new system.
– Jaspos
Nov 22 at 16:03




Not looked at that before. As I have a solution already working on other sites, I am hoping a simple tweak might get this working, rather than setting up a whole new system.
– Jaspos
Nov 22 at 16:03












A lot of java script is running here. I am afraid here no simple tweak will exist and it is not possible just simply set the attribute value from VBA code :(.
– dee
Nov 22 at 22:24






A lot of java script is running here. I am afraid here no simple tweak will exist and it is not possible just simply set the attribute value from VBA code :(.
– dee
Nov 22 at 22:24














2 Answers
2






active

oldest

votes

















up vote
2
down vote













This is dead easy with selenium basic. After install go VBE > Tools > References > Add a reference to selenium type library.



Option Explicit
Public Sub EnterInfo()
Dim d As WebDriver
Set d = New ChromeDriver
Const url = "https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp"

With d
.Start "Chrome"
.get url
.Window.Maximize
'.ExecuteScript "window.scrollTo(0, document.body.scrollHeight);"
.FindElementByCss(".S").Click
.FindElementByCss("#_hdn_30 > div._.widget.buttonfieldwidget.xfaButton").Click
.FindElementByCss("[aria-label=employer]").Click
.FindElementByCss("[aria-label=Name]").SendKeys "Wile E. Coyote"
.FindElementByCss("[aria-label='Name of company']").SendKeys "Acme Corporation"
.FindElementByCss("[aria-label='Position in company']").SendKeys "Entrepreneur"
.FindElementByCss("[aria-label='Telephone number']").SendKeys "012345678910"
.FindElementByCss("[tabindex='1511']").Click
.FindElementByCss("[tabindex='1537']").Click
.FindElementByCss("#_hdn_653 > div._.widget.buttonfieldwidget.xfaButton").Click

Stop

.Quit
End With
End Sub





share|improve this answer

















  • 1




    Thanks QHarr - in fact, this gave me an idea, as I can use SendKeys in my code too, and that seemed to work! Selenuim looks interesting though, I will check it out when I get some time
    – Jaspos
    Nov 23 at 7:36


















up vote
1
down vote













QHarrs link provided the answer - by using SendKeys instead I could enter the data as text into the textboxes.



I did need to set the focus to IE first - I used the info here to get that bit sorted:
Set Focus to Internet Explorer Object in Visual Basic



ie



myIE.visible = false
DoEvents
myIE.visible = true





share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    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',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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%2fstackoverflow.com%2fquestions%2f53433966%2fentering-value-into-webform-text-box-with-vba-works-on-screen-but-data-not-actu%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








    up vote
    2
    down vote













    This is dead easy with selenium basic. After install go VBE > Tools > References > Add a reference to selenium type library.



    Option Explicit
    Public Sub EnterInfo()
    Dim d As WebDriver
    Set d = New ChromeDriver
    Const url = "https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp"

    With d
    .Start "Chrome"
    .get url
    .Window.Maximize
    '.ExecuteScript "window.scrollTo(0, document.body.scrollHeight);"
    .FindElementByCss(".S").Click
    .FindElementByCss("#_hdn_30 > div._.widget.buttonfieldwidget.xfaButton").Click
    .FindElementByCss("[aria-label=employer]").Click
    .FindElementByCss("[aria-label=Name]").SendKeys "Wile E. Coyote"
    .FindElementByCss("[aria-label='Name of company']").SendKeys "Acme Corporation"
    .FindElementByCss("[aria-label='Position in company']").SendKeys "Entrepreneur"
    .FindElementByCss("[aria-label='Telephone number']").SendKeys "012345678910"
    .FindElementByCss("[tabindex='1511']").Click
    .FindElementByCss("[tabindex='1537']").Click
    .FindElementByCss("#_hdn_653 > div._.widget.buttonfieldwidget.xfaButton").Click

    Stop

    .Quit
    End With
    End Sub





    share|improve this answer

















    • 1




      Thanks QHarr - in fact, this gave me an idea, as I can use SendKeys in my code too, and that seemed to work! Selenuim looks interesting though, I will check it out when I get some time
      – Jaspos
      Nov 23 at 7:36















    up vote
    2
    down vote













    This is dead easy with selenium basic. After install go VBE > Tools > References > Add a reference to selenium type library.



    Option Explicit
    Public Sub EnterInfo()
    Dim d As WebDriver
    Set d = New ChromeDriver
    Const url = "https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp"

    With d
    .Start "Chrome"
    .get url
    .Window.Maximize
    '.ExecuteScript "window.scrollTo(0, document.body.scrollHeight);"
    .FindElementByCss(".S").Click
    .FindElementByCss("#_hdn_30 > div._.widget.buttonfieldwidget.xfaButton").Click
    .FindElementByCss("[aria-label=employer]").Click
    .FindElementByCss("[aria-label=Name]").SendKeys "Wile E. Coyote"
    .FindElementByCss("[aria-label='Name of company']").SendKeys "Acme Corporation"
    .FindElementByCss("[aria-label='Position in company']").SendKeys "Entrepreneur"
    .FindElementByCss("[aria-label='Telephone number']").SendKeys "012345678910"
    .FindElementByCss("[tabindex='1511']").Click
    .FindElementByCss("[tabindex='1537']").Click
    .FindElementByCss("#_hdn_653 > div._.widget.buttonfieldwidget.xfaButton").Click

    Stop

    .Quit
    End With
    End Sub





    share|improve this answer

















    • 1




      Thanks QHarr - in fact, this gave me an idea, as I can use SendKeys in my code too, and that seemed to work! Selenuim looks interesting though, I will check it out when I get some time
      – Jaspos
      Nov 23 at 7:36













    up vote
    2
    down vote










    up vote
    2
    down vote









    This is dead easy with selenium basic. After install go VBE > Tools > References > Add a reference to selenium type library.



    Option Explicit
    Public Sub EnterInfo()
    Dim d As WebDriver
    Set d = New ChromeDriver
    Const url = "https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp"

    With d
    .Start "Chrome"
    .get url
    .Window.Maximize
    '.ExecuteScript "window.scrollTo(0, document.body.scrollHeight);"
    .FindElementByCss(".S").Click
    .FindElementByCss("#_hdn_30 > div._.widget.buttonfieldwidget.xfaButton").Click
    .FindElementByCss("[aria-label=employer]").Click
    .FindElementByCss("[aria-label=Name]").SendKeys "Wile E. Coyote"
    .FindElementByCss("[aria-label='Name of company']").SendKeys "Acme Corporation"
    .FindElementByCss("[aria-label='Position in company']").SendKeys "Entrepreneur"
    .FindElementByCss("[aria-label='Telephone number']").SendKeys "012345678910"
    .FindElementByCss("[tabindex='1511']").Click
    .FindElementByCss("[tabindex='1537']").Click
    .FindElementByCss("#_hdn_653 > div._.widget.buttonfieldwidget.xfaButton").Click

    Stop

    .Quit
    End With
    End Sub





    share|improve this answer












    This is dead easy with selenium basic. After install go VBE > Tools > References > Add a reference to selenium type library.



    Option Explicit
    Public Sub EnterInfo()
    Dim d As WebDriver
    Set d = New ChromeDriver
    Const url = "https://public-online.hmrc.gov.uk/lc/content/xfaforms/profiles/forms.html?contentRoot=repository:///Applications/NICs_iForms/1.0/CA3822&template=CA3822.xdp"

    With d
    .Start "Chrome"
    .get url
    .Window.Maximize
    '.ExecuteScript "window.scrollTo(0, document.body.scrollHeight);"
    .FindElementByCss(".S").Click
    .FindElementByCss("#_hdn_30 > div._.widget.buttonfieldwidget.xfaButton").Click
    .FindElementByCss("[aria-label=employer]").Click
    .FindElementByCss("[aria-label=Name]").SendKeys "Wile E. Coyote"
    .FindElementByCss("[aria-label='Name of company']").SendKeys "Acme Corporation"
    .FindElementByCss("[aria-label='Position in company']").SendKeys "Entrepreneur"
    .FindElementByCss("[aria-label='Telephone number']").SendKeys "012345678910"
    .FindElementByCss("[tabindex='1511']").Click
    .FindElementByCss("[tabindex='1537']").Click
    .FindElementByCss("#_hdn_653 > div._.widget.buttonfieldwidget.xfaButton").Click

    Stop

    .Quit
    End With
    End Sub






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 23 at 5:48









    QHarr

    28.2k81839




    28.2k81839








    • 1




      Thanks QHarr - in fact, this gave me an idea, as I can use SendKeys in my code too, and that seemed to work! Selenuim looks interesting though, I will check it out when I get some time
      – Jaspos
      Nov 23 at 7:36














    • 1




      Thanks QHarr - in fact, this gave me an idea, as I can use SendKeys in my code too, and that seemed to work! Selenuim looks interesting though, I will check it out when I get some time
      – Jaspos
      Nov 23 at 7:36








    1




    1




    Thanks QHarr - in fact, this gave me an idea, as I can use SendKeys in my code too, and that seemed to work! Selenuim looks interesting though, I will check it out when I get some time
    – Jaspos
    Nov 23 at 7:36




    Thanks QHarr - in fact, this gave me an idea, as I can use SendKeys in my code too, and that seemed to work! Selenuim looks interesting though, I will check it out when I get some time
    – Jaspos
    Nov 23 at 7:36












    up vote
    1
    down vote













    QHarrs link provided the answer - by using SendKeys instead I could enter the data as text into the textboxes.



    I did need to set the focus to IE first - I used the info here to get that bit sorted:
    Set Focus to Internet Explorer Object in Visual Basic



    ie



    myIE.visible = false
    DoEvents
    myIE.visible = true





    share|improve this answer

























      up vote
      1
      down vote













      QHarrs link provided the answer - by using SendKeys instead I could enter the data as text into the textboxes.



      I did need to set the focus to IE first - I used the info here to get that bit sorted:
      Set Focus to Internet Explorer Object in Visual Basic



      ie



      myIE.visible = false
      DoEvents
      myIE.visible = true





      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        QHarrs link provided the answer - by using SendKeys instead I could enter the data as text into the textboxes.



        I did need to set the focus to IE first - I used the info here to get that bit sorted:
        Set Focus to Internet Explorer Object in Visual Basic



        ie



        myIE.visible = false
        DoEvents
        myIE.visible = true





        share|improve this answer












        QHarrs link provided the answer - by using SendKeys instead I could enter the data as text into the textboxes.



        I did need to set the focus to IE first - I used the info here to get that bit sorted:
        Set Focus to Internet Explorer Object in Visual Basic



        ie



        myIE.visible = false
        DoEvents
        myIE.visible = true






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 23 at 7:38









        Jaspos

        48110




        48110






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • 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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2fstackoverflow.com%2fquestions%2f53433966%2fentering-value-into-webform-text-box-with-vba-works-on-screen-but-data-not-actu%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

            What visual should I use to simply compare current year value vs last year in Power BI desktop

            Alexandru Averescu

            Trompette piccolo