How can I construct a URL that will automatically fill in a field on the target page, when the field doesn't have an ID? The field I need to populate has code that looks like this:
<input type="text" name="subject" size="40" maxlength="255" onchange="max255(this)">
Using an answer that I found here, I created an HTML page that uses jQuery to construct a URL based on what input a user types into a field. Then when you click a button, it goes to that URL, with the user input added to the end of the URL.
What I need it to do now is fill that field in the target page, with what the user entered in the field.
The normal link to the target page is similar to this:
xxx.com/bin/tools/new_view.cgi?type=11111
I think that If the field I want to populate had an ID, let's say the ID was also "subject", then it might be a matter of just modifying my jQuery code so that my generated URL was:
xxx.com/bin/tools/new_view.cgi?type=1111#subject=what was typed into the form on my page
This doesn't work however, because subject
is the field's name, not its ID.
If I inspect that element on the target page, and modify it by adding a value, like this:
<input type="text" name="subject" size="40" maxlength="255" onchange="max255(this)" value="My Text">
then I see My Text
filled in the field (until I reload the page anyway).
Is there any way to target and populate that field as it is now? Or do I have to get them to add an ID to that field?