Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to auto-fill a form field WITHOUT extension and cookie - just by URL parameter?

2 views
Skip to first unread message

Camille Petersen

unread,
Dec 27, 2009, 3:02:10 AM12/27/09
to
Assume I go to a webpage with a form and a couple of entry fields.

Normally these entry fields are not pre-filled with values.
Is there a way to fill them (only a part) automatically anyway?

This should NOT be achieved e.g. by cookies or by 3rd party Firefox extensions
but by appending some parameter on the URL.

Lets assume the following example:

http://www.web.de/fm/

and I want to fill the field labelled "WEB.DE Nutzer" (which means loginname).
So when I investigate the HTML source code I could imagine that something like

http://www.web.de/fm/?inpLoginUsername=myname123

must do the trick but the way above does not work.

Do I have to refer to the "id" or "name"?


The form code looks like:

<form id="formLogin" action="https://login.web.de/intern/login/" name="fm" method="post">
<fieldset>
<input type="hidden" value="freemail" name="service"/>
<input type="hidden" value="https://freemail.web.de" name="server"/>
<input type="hidden" value="https://freemail.web.de/msg/temporaer.htm" name="onerror"/>
<input type="hidden" value="https://freemail.web.de/msg/logonfailed.htm" name="onfail"/>
<legend>Login</legend>
<label for="inpLoginUsername">WEB.DE Nutzer</label>
<input id="inpLoginUsername" type="text" name="username"/>
<label for="inpLoginPasswd">Passwort</label>
<input id="inpLoginPasswd" type="password" name="password"/>
<input class="submit" type="submit" value="Login" name="rv_dologon"/>
</fieldset>
<ul id="loginLinks">
</ul>
</form>

Camille

Camille Petersen

unread,
Dec 27, 2009, 3:02:49 AM12/27/09
to

Jukka K. Korpela

unread,
Dec 27, 2009, 6:57:15 AM12/27/09
to
Camille Petersen wrote:

> Normally these entry fields are not pre-filled with values.
> Is there a way to fill them (only a part) automatically anyway?

From the HTML perspective, which is the topic of the c.i.w.a.h. group (and
in c.i.w.a.stylesheets the issue was off-topic from the beginning), you can
set an initial (pre-filled) value for a text input field using the
value="..." attribute in an input element.

> This should NOT be achieved e.g. by cookies or by 3rd party Firefox
> extensions but by appending some parameter on the URL.

Cookies, Firefox extensions, and parameters in URLs are outside the scope of
HTML authoring for the WWW. And they are not needed for the purpose of
setting initial values.

There's, however, probably something you are not telling us.

> Lets assume the following example:
>
> http://www.web.de/fm/
>
> and I want to fill the field labelled "WEB.DE Nutzer" (which means
> loginname).

Then the source of the page should be modified so that
<input id="inpClubLoginUsername" type="text" name="username"/>
is replaced by
<input id="inpClubLoginUsername" type="text" name="username" value="xxx"/>
where "xxx" is the desired initial value.

> So when I investigate the HTML source code I could imagine that
> something like
>
> http://www.web.de/fm/?inpLoginUsername=myname123
>
> must do the trick but the way above does not work.

What made you imagine that? Stop smoking it! :-)

A web site _could_ be programmed so that data in the query parts of URLs is
used to modify page content, rendering, or behavior. That's actually fairly
common, and could be done with server-side programming or client-side
programming. But being programming, it is outside the scope of HTML.

And if you wish to know what a site may have done in that respect, you would
need to ask its management, or read its instructions, or find it out from
JavaScript source code associated with the page.

> Do I have to refer to the "id" or "name"?

No. Neither will help.

> The form code looks like:

We can see what it looks like by accessing the page by its URL (actually,
more reliably than from a copy posted to Usenet, where it can be munged by
newsreaders and excuses for newsreaders).

How about telling us what you really wish to accomplish? Which kind of a WWW
page would you like to create? You have so far been just referring to
modifications to the behavior of an existing page that is apparently outside
your control.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Roy A.

unread,
Dec 27, 2009, 7:15:02 AM12/27/09
to
On 27 Des, 09:02, cpet_mag...@hotmail.com (Camille Petersen) wrote:
> Assume I go to a webpage with a form and a couple of entry fields.
>
> Normally these entry fields are not pre-filled with values.
> Is there a way to fill them (only a part) automatically anyway?

There is no way you can do that with css.

> This should NOT be achieved e.g. by cookies or by 3rd party Firefox extensions
> but by appending some parameter on the URL.

You could use javascript, but it is best to use a server side script
like php, e.g.:

<input id="inpLoginUsername" type="text" name="username" value="<?php
print $_GET['username'] ; ?>" />

or

<?php
$username = isset($_GET['username']) ? $_GET['username'] : '';
$username = htmlspecialchars( $username );
?>
<input id="inpLoginUsername" type="text" name="username" value="<?php
print $username; ?>" />

Roy A.

unread,
Dec 27, 2009, 7:43:48 AM12/27/09
to
On 27 Des, 09:02, cpet_mag...@hotmail.com (Camille Petersen) wrote:
> Assume I go to a webpage with a form and a couple of entry fields.
>
> Normally these entry fields are not pre-filled with values.
> Is there a way to fill them (only a part) automatically anyway?

There is no way you can do that with css.

> This should NOT be achieved e.g. by cookies or by 3rd party Firefox extensions


> but by appending some parameter on the URL.

You could use javascript, but it is best to use server side script

Mark Hansen

unread,
Dec 27, 2009, 11:09:40 AM12/27/09
to
On 12/27/2009 12:02 AM, Camille Petersen wrote:
> Assume I go to a webpage with a form and a couple of entry fields.

The other responses are assuming you're trying to create an HTML page which
includes this feature (and rightly so, given the group to which you've posted
your question). However, it seems to me you're asking how you can use your
browser to go to an existing HTML page and fill in the values, is that right?

If the page designer doesn't provide any way to pre-fill in the form values,
then something on the client (browser) side will have to do it. This is done
with browser features, like "Form Managers" and extenstions.

You can't do it simply by tacking parameters on to the URL unless the page
designer is looking for those parameters and does what you want with them.


Sorry, I see Jukka covered this in part of his response.

Harlan Messinger

unread,
Dec 27, 2009, 11:48:41 AM12/27/09
to
It's tough to answer your question because it's hard to figure out what
it really is. You ask whether appending parameters to a URL will do what
you ask, when it's obvious, if you just try it, that it won't. Then you
say that you don't want to use any of the means that might exist to
achieve your goal in achieving your goal. Try again?

Adrienne Boswell

unread,
Dec 28, 2009, 10:16:51 AM12/28/09
to
Gazing into my crystal ball I observed cpet_...@hotmail.com (Camille
Petersen) writing in
news:4b3714a9$0$6721$9b4e...@newsspool2.arcor-online.net:

> Assume I go to a webpage with a form and a couple of entry fields.
>
> Normally these entry fields are not pre-filled with values.
> Is there a way to fill them (only a part) automatically anyway?
>
> This should NOT be achieved e.g. by cookies or by 3rd party Firefox
> extensions but by appending some parameter on the URL.
>

Yes, you will have to parse the value of the querystring server side,
eg:

<label for="field1" id="field1">Field1 </label>
<input name="field1" value="<?php echo $_GET[$field1]; ?>" id="field1">

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

kangax

unread,
Jan 9, 2010, 1:21:18 AM1/9/10
to
On 12/28/09 10:16 AM, Adrienne Boswell wrote:
> Gazing into my crystal ball I observed cpet_...@hotmail.com (Camille
> Petersen) writing in
> news:4b3714a9$0$6721$9b4e...@newsspool2.arcor-online.net:
>
>> Assume I go to a webpage with a form and a couple of entry fields.
>>
>> Normally these entry fields are not pre-filled with values.
>> Is there a way to fill them (only a part) automatically anyway?
>>
>> This should NOT be achieved e.g. by cookies or by 3rd party Firefox
>> extensions but by appending some parameter on the URL.
>>
>
> Yes, you will have to parse the value of the querystring server side,
> eg:
>
> <label for="field1" id="field1">Field1</label>
> <input name="field1" value="<?php echo $_GET[$field1]; ?>" id="field1">

That looks like an XSS whole to me.

--
kangax

0 new messages