Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-01-2012, 02:59 PM   PM User | #1
Rae05
New to the CF scene

 
Join Date: Mar 2005
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Rae05 is an unknown quantity at this point
Question correct way to ID hidden fields in html for form submission

I'm an html coder and I want to identify from what website a user has submitted a contact form. The contact form is an <!--#include>file (.shtml) and this contact form include file is being used on two different websites. Since it's only one include. I thought about adding two hidden fields to the include contact form with IDs of the two different sites:

Code:
<input type="hidden" data-id="new_student_signup" name="new_student_signup" value="" />
<input type="hidden" data-id="existing_student_signup" name="existing_student_signup" value="" />
But I'm not sure this will work since it's only one file. Here's why:
  1. If its just one include file, how is the form going to know what site it came from?
  2. Does it require a programming scripting language to get information from a hidden field in html, and if so, will my adding the two hidden input fields (with the data-id="" attribute) be sufficient for the html part of the <!--#include> file?
  3. Should I just create a new include file for the other website and add the hiddenfield to that file?
Example:
for the hidden field "new_student_signup"
Code:
<!--#include virtual="new_students/existing_student_signup.shtml>
for the hidden field "existing_student_signup"
Code:
<!--#include virtual="existing_students/new_student_signup.shtml>

Thanks
Rae05 is offline   Reply With Quote
Old 02-01-2012, 09:07 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
In a web world, there are not very many options. HTTP is stateless, so your options are literally get, post, put, cookie and a few headers.
Most web processing languages do have the ability to use sessions, and can fetch information like the referrer and file specific data.

If you are talking about a remote site, then you cannot do anything to force this without individual specific files. A virtual include isn't really sufficient to perform this task as its not capable of detecting the "client" information (the remote) and populating off of it. Should this be a processable language such as PHP, JSP or Perl then you should be able to request the page from a remote site and provide it with the extra information required though a querystring. This can be used within the form to pass a hidden field. So instead the remote asks for somescript.php?siteid=1234, and you can use this information to generate some token data for use in the html form.

Also, is there a reason this is posted in Java or can this be moved to general web building?
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Tags
form, hiddenfield, html, input

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:36 AM.


Advertisement
Log in to turn off these ads.