469,323 Members | 1,567 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,323 developers. It's quick & easy.

How to prefill a form

I want when visitors go to

http://www.1cellnetindonesia.com/ct_...oko&nama1=test

I want the field memberlain already filled with a name "hardjoko",
that sort of thing. Is there a way to do it?
Jul 23 '05 #1
7 2080
jonathan wrote on 06 jun 2004 in comp.lang.javascript:
I want when visitors go to

http://www.1cellnetindonesia.com/ct_...l#Reg-Temp-Top
?memberlain=hardjoko&nama1=test

I want the field memberlain already filled with a name "hardjoko",
that sort of thing. Is there a way to do it?


Preferably you would do this with serverside code, like ASP(JS/VBS):

<form>
<input name="memberlain" value="<%=Request.querystring("memberlain")%>">
....

=====================================

clientside code is possible:

<script>
function getMemberlain(){
document.getElementById("").value =
document.location.search.replace(/^.*=/,"")
alert(m)
}
</script>
<body onload="getMemberlain()">
<form>
<input name="memberlain" id="memberlain" value="">
......

Not tested

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #2
Evertjan. wrote:
<snip>
http://www.1cellnetindonesia.com/
ct_09DaftarSementara.html#Reg-Temp-Top ^ ?memberlain=hardjoko&nama1=test

<snip>

It may, however, prove valuable for the OP to become familiar with RFC
2396 and the URI syntax it describes, as anything following the fragment
identifier separator - # - is likely to be treated as a fragment
identifier and _not_ as a query string. Making parameters appended to a
fragment identifier as if it was a query unavailable to -
location.search - and probably ASP - Request.querystring -.

Richard.
Jul 23 '05 #3
Richard Cornford wrote on 06 jun 2004 in comp.lang.javascript:
Evertjan. wrote:
<snip>
http://www.1cellnetindonesia.com/
ct_09DaftarSementara.html#Reg-Temp-Top ^ ?memberlain=hardjoko&nama1=test

<snip>

It may, however, prove valuable for the OP to become familiar with RFC
2396 and the URI syntax it describes, as anything following the
fragment identifier separator - # - is likely to be treated as a
fragment identifier and _not_ as a query string. Making parameters
appended to a fragment identifier as if it was a query unavailable to
- location.search - and probably ASP - Request.querystring -.


I do not understand much of what you are saying, but then I am not the
OP.

What fragments do you want to be identified?

Could you explain in beginners language and in simpler English or
perhaps with a translation into Indonesian?

PS:
Just tested the clientside location.search solution.
It had no problems with the
#blah?a=n
string under IE6

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #4
Evertjan. wrote:
Richard Cornford wrote:
Evertjan. wrote:
<snip>
http://www.1cellnetindonesia.com/
ct_09DaftarSementara.html#Reg-Temp-Top ^
?memberlain=hardjoko&nama1=test

<snip>

It may, however, prove valuable for the OP to become familiar with
RFC 2396 and the URI syntax it describes, as anything following the
fragment identifier separator - # - is likely to be treated as a
fragment identifier and _not_ as a query string. Making parameters
appended to a fragment identifier as if it was a query unavailable to
- location.search - and probably ASP - Request.querystring -.


I do not understand much of what you are saying, but then I am not the
OP.

What fragments do you want to be identified?

Could you explain in beginners language and in simpler English ...

<snip>

Err, I don't know if I can explain it satisfactorily, but the URI
grammar rules are:-

<quote cite="RFC 2396 Section 4">
URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
</quote>

<quote cite="RFC 2396 Section 3">
absoluteURI = scheme ":" ( hier_part | opaque_part )
....
hier_part = ( net_path | abs_path ) [ "?" query ]
net_path = "//" authority [ abs_path ]
abs_path = "/" path_segments
</quote>

<quote cite="RFC 2396 Section 5">
relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ]
</quote>

- and given that grammar, a fragment identifier is an optionl part of a
URI-reference and will appear at the end of such a reference, while the
query string is an optional part of either an absoluteURI or a
relativeURI. As an absoluteURI or a relativeURI must appear in a
URI-reference before a fragment identifier (if they appear at all) then
a query string must precede a fragment identifier if the result is going
to conform to the grammar.
PS:
Just tested the clientside location.search solution.
It had no problems with the
#blah?a=n
string under IE6


Maybe, but relying on the behaviour of the very (perhaps overly)
tolerant IE to be reproduced in all other browsers would not be a my
approach to creating a reliable cross-browser end result.

Richard.
Jul 23 '05 #5
Richard Cornford wrote on 06 jun 2004 in comp.lang.javascript:
Maybe, but relying on the behaviour of the very (perhaps overly)
tolerant IE to be reproduced in all other browsers would not be a my
approach to creating a reliable cross-browser end result.


At least I have never had any problems with ASP's

Request.querystring()

==============

The clientside solution with a location.search.replace() sequence
scould be improved upon,
but even better should be avoided if serverside coding is possible.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #6
Evertjan. wrote:
Richard Cornford wrote:
Maybe, but relying on the behaviour of the very (perhaps overly)
tolerant IE to be reproduced in all other browsers would not be a
my approach to creating a reliable cross-browser end result.


At least I have never had any problems with ASP's

Request.querystring()

==============

The clientside solution with a location.search.replace() sequence
scould be improved upon,
but even better should be avoided if serverside coding is possible.


Interesting that you don't see constructing URIs to conform with the
specified grammar as the obvious way of avoiding any issue.

Richard.
Jul 23 '05 #7
Richard Cornford wrote on 07 jun 2004 in comp.lang.javascript:
Interesting that you don't see constructing URIs to conform with the
specified grammar as the obvious way of avoiding any issue.


I am pleased that you find me interesting, Richard.

However, You are missing the point of this NG.

They are, among other uses,
for helping people that ask questions about relevant subjects.

I think it would be better if you take up the issue yourself,
as you seem to be very knowledgable about it.

So please advice the OP with your ideas.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by John | last post: by
5 posts views Thread by Barry Margolin | last post: by
5 posts views Thread by Richard Cornford | last post: by
4 posts views Thread by Targa | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.