Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# Webbrowser and form questions

C# Webbrowser and form questions

Scheduled Pinned Locked Moved C#
csharphtmldatabasehelpquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sean G Murphy
    wrote on last edited by
    #1

    Ok here's the skinny: I want to allow users to create their own forms and they are familiar with html, hence they will write them in html. It is basically data entry, but in varying formats. I want to be access the information they put in the various input boxes through my windows application. Is there a way to query the forms they create. In other words, can I have their forms in an html browser on one panel and have the submit button on another panel where the code would reside and I can see their entered data? I appreciate any and all help!

    Thanks! Sean Murphy "All things great and small start at the same point, the first step."

    R 1 Reply Last reply
    0
    • S Sean G Murphy

      Ok here's the skinny: I want to allow users to create their own forms and they are familiar with html, hence they will write them in html. It is basically data entry, but in varying formats. I want to be access the information they put in the various input boxes through my windows application. Is there a way to query the forms they create. In other words, can I have their forms in an html browser on one panel and have the submit button on another panel where the code would reside and I can see their entered data? I appreciate any and all help!

      Thanks! Sean Murphy "All things great and small start at the same point, the first step."

      R Offline
      R Offline
      RepliCrux
      wrote on last edited by
      #2

      Hi Sean, May be I did not understand what you wanted, but I think Sharepoint is what you need. Or if you want an ASP.NET application, you will have to build a Custom CMS (content management system), where you can allow users to create something like articles and and then, when they submit the article, you can review them before it goes online.... If above does not makes any sense, I am sorry :)

      S 1 Reply Last reply
      0
      • R RepliCrux

        Hi Sean, May be I did not understand what you wanted, but I think Sharepoint is what you need. Or if you want an ASP.NET application, you will have to build a Custom CMS (content management system), where you can allow users to create something like articles and and then, when they submit the article, you can review them before it goes online.... If above does not makes any sense, I am sorry :)

        S Offline
        S Offline
        Sean G Murphy
        wrote on last edited by
        #3

        I want to read the text from input objects, like a basic textbox for a name, in an html document but without it having to be "post"ed. here's an example

        Name:
        Address:

        Notice there is no submit button on the form. Someone would fill in their name and a line of their address then click a System.Windows.Forms.Button Here is my code (which doesn't work) foreach(HtmlElement elt in browser.Document.Forms) { foreach(HtmlElement ch in elt.GetElementsByTagName("INPUT")) { MessageBox.Show("Text = " + ch.InnerText); } } I was expecting it would show the text that was typed in but I keep getting a blank return. Any help would be great!

        Thanks! Sean Murphy "All things great and small start at the same point, the first step."

        R 1 Reply Last reply
        0
        • S Sean G Murphy

          I want to read the text from input objects, like a basic textbox for a name, in an html document but without it having to be "post"ed. here's an example

          Name:
          Address:

          Notice there is no submit button on the form. Someone would fill in their name and a line of their address then click a System.Windows.Forms.Button Here is my code (which doesn't work) foreach(HtmlElement elt in browser.Document.Forms) { foreach(HtmlElement ch in elt.GetElementsByTagName("INPUT")) { MessageBox.Show("Text = " + ch.InnerText); } } I was expecting it would show the text that was typed in but I keep getting a blank return. Any help would be great!

          Thanks! Sean Murphy "All things great and small start at the same point, the first step."

          R Offline
          R Offline
          RepliCrux
          wrote on last edited by
          #4

          You can try writing client side code, javascript may be. In the textbox, you can register the script for key up (or some other as convenient) txtBox.Attributes.Add("onKeyup",javascript:ShowText(this.ID)"); and javascript: ShowText(param) { var textBox = document.GetElementByID(param); alert(txtBox.Value); } hope that does that.

          S 1 Reply Last reply
          0
          • R RepliCrux

            You can try writing client side code, javascript may be. In the textbox, you can register the script for key up (or some other as convenient) txtBox.Attributes.Add("onKeyup",javascript:ShowText(this.ID)"); and javascript: ShowText(param) { var textBox = document.GetElementByID(param); alert(txtBox.Value); } hope that does that.

            S Offline
            S Offline
            Sean G Murphy
            wrote on last edited by
            #5

            That lead me perfectly down the path I needed to go. Thanks RepliCrix! For anyone else out there, the code I used was C# public form1() { InitializeComponent(); // Make the form the scripting object browser.ObjectForScripting = this; // Display the html file file.html browser.Navigate(Application.StartupPath + "\\file.html"); } void Button1Click(object sender, EventArgs e) { foreach(HtmlElement elt in browser.Document.Forms) { foreach(HtmlElement child in elt.GetElementsByTagName("INPUT")) { browser.Document.InvokeScript("SendTypedText", new object[] { child.Name }); } } } public void ShowText(string ibox_name, string ibox_value) { MessageBox.Show(ibox_name + " = " + ibox_value); //Of course now you can do whatever you need to do with the data } //file.html code

            Box1:
            Box2:
            Box3:

            //Send Back Input Values function SendTypedText(param) { var thisForm = document.forms[0]; window.external.ShowText(param, thisForm[param].value); }

            Thanks! Sean Murphy "All things great and small start at the same point, the first step."

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups