Only send certain fields

Posted on 2003-11-21
Last Modified: 2010-04-09
Is there anyway I can choose which fields i want sent in a posted form?
I currently have the fields user and pass and enc in a login form.
Enc is an encryption of pass.
I only want to send user and enc.

I have thought about just encrypting pass into the pass field when the user attempts to login, but i don't want to do it this way.

Is there any other option i can try?
Question by:enasni_mark

Expert Comment

ID: 9800093
Here you go!

<script type="text/javascript">
function encryptit(){
  testform2.enc2.value = //encrypted password
  testform2.user2.value = testform.user.value;
<form name="testform" onSubmit="encryptit();">
Username: <input type="text" name="user"><br>
Password: <input type="password"><br>
<div align="center"><input type="submit">

<form name="testform2" action="somepage" method="post">
 <input type="hidden" name="enc2">
<input type="hidden" name="user2">

Expert Comment

ID: 9800100
You could always add a onSubmit event that will remove the pass field from your form before sending it.

onSubmit="mForm.pass.value = ''; return true;"

LVL 16

Expert Comment

ID: 9800195
how are you encrypting your code?
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why


Expert Comment

ID: 9800386
he's not encrypting his code, just the password that the user enters. :)
LVL 58

Expert Comment

ID: 9800928
<script language=javascript>
function submitform(){

<form name=myform1>
<input type=text name=user>
<input type=text name=pass>
<input type=text name=enc>
<input type=button onclick=submitform()>
<form name=myform2 action=page2.asp>
<input type=hidden name=user>
<input type=hidden name=enc>
<input type=button onclick=submitform()>
LVL 11

Expert Comment

ID: 9801258
Depending on JS to do encryption is not a very good idea IMO.

If you need that much security, consider using SSL.

Otherwise, many serverside programming languages and databases provide ways to encrypt/decrypt passwords.

E.g. in PHP/MySQL:

$user = $_POST["username"];
$pass = $_POST["password"];

$q = "SELECT userid FROM users WHERE username='$user' AND password=MD5('$pass')";
if(mysql_num_rows( mysql_query($q) ) == 1)
  $login_status = TRUE;
LVL 31

Accepted Solution

GwynforWeb earned 125 total points
ID: 9801483
Disable the fields before submission. I have demonstrated for 'get' but it works for post as well. (google is great for seeing what gets sent)

<form onSubmit="t3.disabled=true;t4.disabled=true; return true" action="">
<input type="text" name="t1" >
<input type="text" name="t2">
<input type="text" name="t3">
<input type="text" name="t4">
<input type="submit"" value="submit">
LVL 31

Expert Comment

ID: 9806687
Thanks, :-)

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Zoom the page when you go in from your phone 3 54
How to count in a table in php 22 36
ebay seller html tags 2 25
How to get this page layout correct 13 29
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question