locked
Auto complete form / drop downs. RRS feed

  • Question

  • Hey guys, 

    So to make it simple, the form im trying to auto complete is this: 

    http://gyazo.com/74e8e8f4667db6e4213fd665f295ff05

    As it stands, everything is working but the country drop down.... 

    Despite me filling it out in the same way im filing out the other drop downs , an despite the fact it does in fact change its value, when the page proceeds, it gets this error:

    http://gyazo.com/c724b5a8da55b293670b52df056fc964

    The country drop down field, is the only one thats automatically populated when it loads, iv'e tried not touching it at all, but the error still happens. 

    If i jump in between the form getting filled in, and it pressing submit, an i manually change the drop down option, then it works fine....

    I feel so close, an yet so far.... this thing is driving me insane, if any one can shed some light, id be beyond grateful. 

    The form its self can be found on http://www.origin.com and clicking on register. 

    The code im using is as follows.

    This works fine in terms of changing the values, and everything else works ok, so ive also included the security question drop down code to compare too. 

                            foreach (HtmlElement el in wbXboxLive.Document.GetElementsByTagName("select"))
                            {
                                if (el.Name == "country")
                                {
    
    
                                    foreach (HtmlElement comboItem in el.Children)
                                    {
    
                                        if (comboItem.GetAttribute("value") == "US")
                                        {
                                            comboItem.SetAttribute("Selected", "True");
    
                                            HtmlElement elem = this.wbXboxLive.Document.GetElementById("clientreg_country");
                                            string param = "United States of America";
                                            elem.FirstChild.FirstChild.InnerText = param.PadLeft(1); 
                                        }
                                    }
                                }
                                if (el.Name == "securityQuestion")
                                {
                                    foreach (HtmlElement comboItem in el.Children)
                                    {
                                        Console.WriteLine(comboItem.InnerText + " " + comboItem.GetAttribute("Selected"));
                                        if (comboItem.InnerText == "What is the name of your favorite pet?")
                                        {
                                            comboItem.SetAttribute("Selected", "True");
                                            HtmlElement elem = this.wbXboxLive.Document.GetElementById("clientreg_securityqa");
                                            elem.FirstChild.FirstChild.InnerText = "What is the name of your favorite pet?";
                                        }
                                    }
                                }
    }


    Thanks for any help! 



    • Edited by CraigBaines Tuesday, February 3, 2015 3:59 PM
    Tuesday, February 3, 2015 3:59 PM

Answers

  • The webbrowser control is for rendering web content. If you don't have any of that then using a web browser control doesn't make sense. If you do have web content then your question is clearly about a web app and should go to ASP.NET. If you don't need the web content then forget the HTML and web browser and use the standard Windows UI frameworks like WPF or Winforms. They each have their own forums where you can post questions like this.
    • Marked as answer by CraigBaines Wednesday, February 4, 2015 9:41 AM
    Tuesday, February 3, 2015 7:19 PM

All replies

  • Hello,

    Is this ASP.NET and if so you would be better off asking in the ASP.NET forum which is not part of these forums. If not ASP.NET please elaborate.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

    Tuesday, February 3, 2015 4:12 PM
  • Im using a webbrowser from within my windows form.
    Tuesday, February 3, 2015 4:14 PM
  • Is there a reason for using a webbrowser control rather than regular form controls?


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

    Tuesday, February 3, 2015 4:21 PM
  • this is a c# forum, please move your problem to asp.net forum:

    forums.asp.net

    • Proposed as answer by bouzidmed Wednesday, February 4, 2015 8:55 PM
    Tuesday, February 3, 2015 4:22 PM
  • It is a c# app? .... 

    And im not sure, first time tryign this... this is just how i got it to work. Im just stuck on this part! 
    Tuesday, February 3, 2015 4:36 PM
  • The webbrowser control is for rendering web content. If you don't have any of that then using a web browser control doesn't make sense. If you do have web content then your question is clearly about a web app and should go to ASP.NET. If you don't need the web content then forget the HTML and web browser and use the standard Windows UI frameworks like WPF or Winforms. They each have their own forums where you can post questions like this.
    • Marked as answer by CraigBaines Wednesday, February 4, 2015 9:41 AM
    Tuesday, February 3, 2015 7:19 PM
  • Sure, no problem. Thanks for the clarification rather than the simple "get out" lol. 
    Wednesday, February 4, 2015 9:41 AM