Cannot get all input, textarea, option of form

Topics: Developer Forum, User Forum
Jun 7, 2012 at 3:00 PM

Hi all

I want to get get all input, textarea, option of http://diendan.yeutretho.com/register.php form but it return null. This is my code

HtmlAgilityPack.HtmlWeb web = new HtmlWeb();           

HtmlAgilityPack.HtmlDocument htmlDoc = web.Load("http://diendan.yeutretho.com/register.php");         

var forms = htmlDoc.DocumentNode.Descendants("form");           

foreach (var form in forms)           

{               

if (form.Attributes["name"] != null && form.Attributes["name"].Value == "register")                {                   

Console.WriteLine(  form.InnerHtml );                   

}

 }

Pls help me to get all input, textarea, select of HTML Form

Best Regards

Nam

truongthanhnam@gmail.com

skype: nam.truongthanh

Jun 12, 2012 at 9:34 PM

You can use this open source project to resolve this issue.

http://sgmleskulapnet.codeplex.com/

Jun 12, 2012 at 11:59 PM

To allow form to have child elements use the modify the HtmlNode.HtmlElements collection and remove the "form" item.

ElementsFlags.Remove("form")