473,657 Members | 2,540 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting all the input elements of a malformed form tag

I'm trying to get a list of all the input elements of a form tag and
am having some difficulty doing so. First, here's my XHTML:

<div>
<form action="">
<input type="text" name="a" />
</div>
<div>
<input type="text" name="b" />
</div>
<div>
<input type="submit" />
</form>
</div>

It isn't semantically correct XHTML but that doesn't stop web
developers from coding like that.

Anyway, in both Firefox and IE, if you visit a webpage containing the
above, and hit the Submit button, the resultant URL will have both a
and b defined via GET.

I'd like to be able to get a list of the same input parameters that
the browser does for a given form element. I had been using "//
form[1]//input" as an XPath query, but that doesn't work, here,
because not all of the inputs are children of the form element.
Indeed, if I use DOMDocument::sa veHTML(), I get something more like
this:

<div>
<form action="">
<input type="text" name="a" />
</form>
</div>
<div>
<input type="text" name="b" />
</div>
<div>
<input type="submit" />
</div>

Any ideas?
Sep 3 '08 #1
5 2259
On Sep 3, 7:05 am, yawnmoth <terra1...@yaho o.comwrote:
I'm trying to get a list of all the input elements of a form tag and
am having some difficulty doing so. First, here's my XHTML:

<div>
<form action="">
<input type="text" name="a" />
</div>
<div>
<input type="text" name="b" />
</div>
<div>
<input type="submit" />
</form>
</div>

It isn't semantically correct XHTML but that doesn't stop web
developers from coding like that.

Anyway, in both Firefox and IE, if you visit a webpage containing the
above, and hit the Submit button, the resultant URL will have both a
and b defined via GET.

I'd like to be able to get a list of the same input parameters that
the browser does for a given form element. I had been using "//
form[1]//input" as an XPath query, but that doesn't work, here,
because not all of the inputs are children of the form element.
Indeed, if I use DOMDocument::sa veHTML(), I get something more like
this:

<div>
<form action="">
<input type="text" name="a" />
</form>
</div>
<div>
<input type="text" name="b" />
</div>
<div>
<input type="submit" />
</div>

Any ideas?
I'm not sure what you're trying to achieve here I'm afraid, but I do
have one piece of advice for you. Fix your HTML. There is no reason
whatsoever for it not to be well formed, and it's only ever going to
cause you grief. If you didn't write teh HTML in question then have a
quiet polite word with whomever did.
Sep 3 '08 #2
On Sep 3, 7:05 am, yawnmoth <terra1...@yaho o.comwrote:
I'm trying to get a list of all the input elements of a form tag and
am having some difficulty doing so. First, here's my XHTML:

<div>
<form action="">
<input type="text" name="a" />
</div>
<div>
<input type="text" name="b" />
</div>
<div>
<input type="submit" />
</form>
</div>

It isn't semantically correct XHTML but that doesn't stop web
developers from coding like that.

Anyway, in both Firefox and IE, if you visit a webpage containing the
above, and hit the Submit button, the resultant URL will have both a
and b defined via GET.

I'd like to be able to get a list of the same input parameters that
the browser does for a given form element. I had been using "//
form[1]//input" as an XPath query, but that doesn't work, here,
because not all of the inputs are children of the form element.
Indeed, if I use DOMDocument::sa veHTML(), I get something more like
this:

<div>
<form action="">
<input type="text" name="a" />
</form>
</div>
<div>
<input type="text" name="b" />
</div>
<div>
<input type="submit" />
</div>

Any ideas?
Oh, something else just occurred to me after I made that previous
post. Why not just use the contents of $_GET?
Sep 3 '08 #3
Message-ID:
<aa************ *************** *******@w7g2000 hsa.googlegroup s.comfrom
yawnmoth contained the following:
>I'd like to be able to get a list of the same input parameters that
the browser does for a given form element. I had been using "//
form[1]//input" as an XPath query, but that doesn't work, here,
because not all of the inputs are children of the form element.
Indeed, if I use DOMDocument::sa veHTML(), I get something more like
this:
Wrong froup methinks.
--
Geoff Berrow 011000100110110 0010000000110
001101101011011 001000110111101 100111001011
100110001101101 111001011100111 010101101011
http://slipperyhill.co.uk - http://4theweb.co.uk
Sep 3 '08 #4
the variables are in the $_GET array.
Sep 3 '08 #5
On Sep 3, 3:10 am, Gordon <gordon.mc...@n tlworld.comwrot e:
On Sep 3, 7:05 am,yawnmoth<ter ra1...@yahoo.co mwrote:
I'm trying to get a list of all the input elements of a form tag and
am having some difficulty doing so. First, here's my XHTML:
<div>
<form action="">
<input type="text" name="a" />
</div>
<div>
<input type="text" name="b" />
</div>
<div>
<input type="submit" />
</form>
</div>
It isn't semantically correct XHTML but that doesn't stop web
developers from coding like that.
Anyway, in both Firefox and IE, if you visit a webpage containing the
above, and hit the Submit button, the resultant URL will have both a
and b defined via GET.
I'd like to be able to get a list of the same input parameters that
the browser does for a given form element. I had been using "//
form[1]//input" as an XPath query, but that doesn't work, here,
because not all of the inputs are children of the form element.
Indeed, if I use DOMDocument::sa veHTML(), I get something more like
this:
<div>
<form action="">
<input type="text" name="a" />
</form>
</div>
<div>
<input type="text" name="b" />
</div>
<div>
<input type="submit" />
</div>
Any ideas?

Oh, something else just occurred to me after I made that previous
post. Why not just use the contents of $_GET?
I'm using cURL to grab the contents of the webpage and
DOMDocument::lo adHTML() to parse the contents. Although I'd certainly
like to send a request via GET, it's getting all the variables that
I'd need to do so that's the hard part.
Sep 3 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4979
by: Kai Grossjohann | last post by:
I would like to put a text input field (in the sense of <input type="text">) and an image next to each other, where I know the size in pixels of the image, and I know the total width in em. I haven't found a way to do this. I tried <span style="width:20em"> <input type="text"> <img width="25px" src="...">
6
6183
by: Michael Hamm | last post by:
Hi, I'm trying to write a <form> whihc will retrieve a Web page on another server. I have (essentially) this: <form action="http://cgi.cs.indiana.edu/~oracle/digest.cgi"> <input type="submit"><select name="N"> <option value="1234#1234-01">foo <option value="1010#1010-02">bar <option value="1001#1001-03">baz
18
7990
by: lawrence | last post by:
If I'm pretty sure there is just one form on the page, can i do this? var myForm = document.forms; If I'm not sure about the form, is it safer to do this? if (document.forms) { var myForm = document.forms; // more code here........ }
6
4385
by: Dennis Allen | last post by:
Hi. I got a checkbox in a form. When the form is submitted, an email is generated. In the email text is the field name: on or off. The client doesn't want to see on or off, but yes or no. Question. Before I submit the form, is it possible to change the input from checkbox to text? If it was checked, have the value Yes, otherwise No?
3
1294
by: Ed Jay | last post by:
When I run the below js, I get the error: "document.form1.elements.checked) is null or not an object" <script type="text/javascript"> function get_menu_value(menu_name) { var mValue = 0; for(var i=0; i < menu_name.length; i++) {
0
3707
by: ruju00 | last post by:
I am getting an error in Login() method of the following class FtpConnection public class FtpConnection { public class FtpException : Exception { public FtpException(string message) : base(message){} public FtpException(string message, Exception innerException) : base(message,innerException){}
10
2426
by: eggie5 | last post by:
Is it possible to get a file without using a form post? I want to get the data (bytes) of a file, text or binary, and just save it to a variable. Similar to the post body of a form that has a file input element in it. Ultimately what I want to do is get a file off client machine (that they specify) and send it to the server using a standard post request. This is exactly the same as a form post with an file input element, but I don't...
5
1328
by: laredotornado | last post by:
Hi, I have a number of INPUTs on my page that look like <input id="form_items" name="form_items " size="15" type="text" value="..." /> How do I refer the last one of these on my page? Thanks, - Dave
8
2684
omerbutt
by: omerbutt | last post by:
hi there i have a form with multiple input (type/text ) fields and three inputs(type/file) fields i have to submit the form via ajax because i have multiple forms on this page ,you can say it is a contact_us.php page.Now i can get all the inputs at the other end else the input(type/file) i donot want a submit button what i want that some how io can send the file name and the path of the picture that is to be uploaded and send to a page via ajax...
0
8425
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8845
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8522
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8622
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5647
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.