The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Submit form question
crusty
post Mar 21 2012, 01:42 PM
Post #1





Group: Members
Posts: 4
Joined: 21-March 12
Member No.: 16,758



I am trying to build a form where you input a value and when you hit [Submit] it attaches that value to the end of a URL and targets it into a lower frame. I know how to make framesets and I know how to target specific frames.

For example:
If you input "577095475" (without the quotes) then hit submit it attaches the numbers to
"http://facebook.com/profile.php?id=" (again, without the quotes)
and "http://facebook.com/profile.php?id=577095475" shows up in the lower frame or a new tab / window.

Is this possible?

Thanks in advance!
-Josh
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Mar 21 2012, 02:21 PM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



It depends on what method you use (as in the method attribute for FORM). When GET is used, the form data is sent as a query string in the URL, what you want.

Read about it here: http://htmlhelp.com/reference/html40/forms/form.html .
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 21 2012, 02:25 PM
Post #3


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



QUOTE(crusty @ Mar 21 2012, 07:42 PM) *

"http://facebook.com/profile.php?id=577095475" shows up in the lower frame or a new tab / window.

The textfield should have the NAME "id", and the form's TARGET should be the name of the lower frame (or "_blank" to open a new window). The form's ACTION should be "http://facebook.com/profile.php".
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
crusty
post Mar 21 2012, 02:25 PM
Post #4





Group: Members
Posts: 4
Joined: 21-March 12
Member No.: 16,758



ok... sorry to waste anybody's time but I got it using:

CODE

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled</title>
<script>
function convertURL() {
var url = document.getElementsByName( "url")[0];
var fullurl = document.getElementsByName( "fullurl")[0];
fullurl.value = "http://facebook.com/profile.php?id="+ url.value +"";
}
</script>
</head>
<body>



<!-- do not name objects reserved words: search, submit, reset, etc. -->
<form name= "Search" onsubmit='convertURL();location.href=fullurl.value;return false'>
<p>
<input name='url' type='text' size="20" />
<input name='fullurl' type='hidden' />  
<input name="submitTwo" id="submitTwo" type="submit" value="Search">
</form>




</body>
</html>


so far it works great but I can't figure out how to target a specific frame.
Any suggestions?

Again, thanks in advance!
-Josh
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 21 2012, 02:28 PM
Post #5


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



QUOTE(crusty @ Mar 21 2012, 08:25 PM) *

ok... sorry to waste anybody's time but I got it using:

No need to use javascript for this. smile.gif

QUOTE
I can't figure out how to target a specific frame.

See my reply above.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
crusty
post Mar 21 2012, 02:33 PM
Post #6





Group: Members
Posts: 4
Joined: 21-March 12
Member No.: 16,758



QUOTE(Christian J @ Mar 21 2012, 03:28 PM) *

QUOTE(crusty @ Mar 21 2012, 08:25 PM) *

ok... sorry to waste anybody's time but I got it using:

No need to use javascript for this. smile.gif

QUOTE
I can't figure out how to target a specific frame.

See my reply above.


I'm sorry...
can you give me an example?
I'm stumped
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
crusty
post Mar 21 2012, 02:40 PM
Post #7





Group: Members
Posts: 4
Joined: 21-March 12
Member No.: 16,758



I got it... thanks for the help!!
I really do appreciate it!!

this is what I did:
CODE

<form action="http://facebook.com/profile.php" method="get" target="new">
<input type="text" name="id"/>
<input type="submit" value="Search"/>
</form>


Thanks again!!
Awesome help!
-Josh
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 21 2012, 03:55 PM
Post #8


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



You're welcome! Hm, is "new" the name of your frame? If you just want to open a new window, there's a difference between the keyword "_blank" and names such as "new", "foo", etc: http://thedesignspace.net/MT2archives/000316.html
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th April 2024 - 12:12 AM