I am writing a method that will take a screenshot of a passed form element, and print it out. There are a few challenges I am facing. I want to be able to make this method generic enough to accept just about any type of form element. I set the "element" argument to type "object". I think I will also need to pass a "type" argument or is there a way to figure out what type the object is after it is passed?
static public void PrintFormElement(object element, ?type?){
}
Am I approaching this problem the right way? Any advice would be appreciated thanks!
If something is a form, use a form element. This helps assistive devices like screen readers better understand the content of the page and give the person using them more meaningful information.
In order to access the form element, we can use the method getElementById() like this: var name_element = document. getElementById('txt_name'); The getElementById() call returns the input element object with ID 'txt_name' .
Appends form-data inside the body of the HTTP request (data is not shown in URL)
Since GET appends the form data to the current URL, it can only be used where the contents of the submission (including the complete URL) will result in a string that is 2048 characters long, or less. This is the maximum length of a URL. GET can only be used to send ASCII data.
You can find out what type something is either using the is/as
operators, or using GetType
. It's usually a bit of a design smell if you have to use them though. What are you planning to do that's type-specific?
If you're talking about visual elements, you might want to use Control
instead of object
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With