Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Populating A Form From A Link
kvarnerexpress
post Dec 10 2005, 04:45 PM
Post #1


Super Member
*********

Group: Members
Posts: 407
Joined: 13-December 04
Member No.: 2,696



I have an online application Form that multiple groups use from their own webpages. I would like the form to automatically populate a couple fields depending on which group's site it's clicked from......... I think there is a way to populate a form just by adding stuff to the link, but I don't know how and I can't find any information on how online (not really sure what to search)......... anyone know? I want a combo-box and a text field automatically populated with information depending on the link that's clicked.

I honestly don't know if this is an HTML thing or a Javascript thing... if need be I'll go ask on the Javascript forum instead.

Thanks!
Go to the top of the page
 
+Quote Post
Tyssen
post Dec 11 2005, 04:39 AM
Post #2



***********

Group: Members
Posts: 1,161
Joined: 9-May 05
From: Brisbane, QLD
Member No.: 6,818



It sounds like you're talking about using the querystring to pass variables to your form. So your link would be something like link.php?id=X&somevalue=Y&someothervalue=Z.
Then you use $_GET or $_REQUEST to access the variables and then print them to your form.
Go to the top of the page
 
+Quote Post
scab_dog
post Dec 11 2005, 05:02 AM
Post #3


V-Man
*********

Group: Members
Posts: 370
Joined: 13-March 05
From: In live on Earth which is in the Milky Way which is in the Universe
Member No.: 4,441



I was searching for something similar...i need some help[ as well..Tyseen i dont get what you mean? The page my form is on a HTML file not a php..and yeah i donjt understand what you mean
Go to the top of the page
 
+Quote Post
pawitp
post Dec 11 2005, 06:02 AM
Post #4


Advanced Member
*******

Group: Members
Posts: 145
Joined: 12-September 05
Member No.: 11,779



That's going to be a javascript work, but I reccommend PHP more. Trap17 supports PHP why not use it? It's not that hard to work with PHP, you'll end up using PHP to process the form anyway. So why not using php for the form.

Another thing is you said from a "link". Different links can point to different pages can't it, so why combine it to the same page?
Go to the top of the page
 
+Quote Post
Tyssen
post Dec 11 2005, 06:03 AM
Post #5



***********

Group: Members
Posts: 1,161
Joined: 9-May 05
From: Brisbane, QLD
Member No.: 6,818



You can't achieve this sort of thing without some sort of scripting whether it be PHP, ASP or javascript (not as straightforward in JS anyway I think). Your form will be output to the browser as HTML, but you can use a script to construct that HTML and fill in the values.
So, taking the previous example, the link to the form is link.php?id=X&somevalue=Y&someothervalue=Z.
Using PHP, you'd do something like this:

CODE
<?php print '<input type="text" name"field1" id="field1" value="'.$_GET('somevalue').'" />
print '<input type="text" name"field2" id="field2" value="'.$_GET('someothervalue').'" /> ?>
Go to the top of the page
 
+Quote Post
Lozbo
post Dec 13 2005, 01:19 AM
Post #6


Super Member
*********

Group: Members
Posts: 282
Joined: 1-September 05
From: Wanatos
Member No.: 11,382



I think what you want is that if you select an option in the very form, like a select, other stuff beneath it will get some info, i have something like that... let me get it:

HTML
<select name="acompa" id="acompa" onchange="if(acompa.selectedIndex==1)nombre_acompa.disabled=false; else{nombre_acompa.disabled=true; nombre_acompa.selectedIndex=0}">
<option value="0">-----</option>
<option value="1">yes</option>
<option value="2">no</option>
</select>

Where nombre_acompa is the field that you want to block, or unblock.

I know that you want to actually populate the fields, not block them or unblock them, but you can use this principle and apply this:

document.form.nombre_acompa.value == "text to be set"

In the 'onchange' javascript event.

This would not be valid xhtml 1.0 strict though. (I think there's no "onchange" attribute =P )
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Table/cell Link?(10)
  2. A Good Space For Learn Html(5)
  3. Link Colour(5)
  4. Dropdown Menus Links(3)
  5. Link To Create Desktop Shortcut?(5)
  6. Making A Refresh Link On Your Website.(16)
  7. Refresh Main Window By Clicking Link In Popup?(2)
  8. Creating Link In Html - Help Me With This!(5)


 



- Lo-Fi Version Time is now: 13th October 2008 - 05:37 PM