View Full Version : Javascript for web form and action...(warning: newbie here)

01-21-2009, 06:48 PM
Hi everyone. I'm new to this forum and fairly new to javascript, but a current website project I'm involved in has introduced me to doing some basic javascript coding.

Now, onto my problem/question:

We are redesigning our existing company website which was straight html, css, and some javascript before. Now, the redesign includes the use of a CMS(content management system) called Sitecore. Sitecore requires the use of a form tag that basically surrounds the entire header, body, and footer of the page...it enables in-line real time editing on the site. When the page is generated it create its own action within the form tag.

Problem is, the current way our members sign in (see code below) is not working with the redesign because we cannot use a form tag inside of another existing form tag. On the current site, when the submit button is clicked, a CGI is used to capture values from 3 fields, (a dropdown, and two input fields) but it seems without the form tag set up as it is in our current site, the CGI cannot capture these values.

Here is the existing HTML code:

<form name="form1" method="post" action="https://webaccess.mosers.org/myobjlibp/CCSSN3.pgm" autocomplete ="OFF">
Member ID or SSN
<div align="left">
<select name="PREFHTM" class="drop">
<option value="" selected> Select Login Preference</option>
<option value="VSSN">SSN -- with no hyphens</option>
<option value="VMEMID">Member ID</option>
<input type="password" name="USERHTM" size=9 onKeyUp="autotab(this, document.form1.PINHTM)" maxlength=9 class="member">
<div id="member">
<input name="PINHTM" type="password" id="PINHTM" size="9" maxlength="9" class="member">
<input type="image" name="FormsButton12" src="assets/images/login.gif" alt="Secure Login" value = "Submit" id"FormsButton123">


Fairly Basic stuff.

Can javascript be used to help get around this issue and create a form action for the button? Here is a snippet of the script ive used to try and accomplish this:

function SearchKeypress(sender, evt)
...code to capture Enter key press...
function signIN()
//Determine the search term
var MSignin=document.getElementById('txtMSignInTerm').value;
var MPass=document.getElementById('txtMPassTerm').value;
var MPref=document.getElementById('txtMPrefTerm').value;

var USERHTM = MSignin
var PINHTM = MPass
var PREFHTM = MPref

if ((MPass != '') && (MSignin != '') && (MPref != ''))
{ document.location.href="https://webaccess.mosers.org/myobjlibp/CCSSN3red.pgm";

In the html, basically an onclick event calling the above fuction was used, and the values of the 3 fields above were passed to the javascript. Farthest ive gotten is the redirect to work, but the CGI doesn't capture any variables.

Any suggestions are appreciated. Like I'd said, javascript is a new thing to me, so if Im going about this all wrong you won't hurt my feelings by saying so.

Thanks for taking the time to read this long post!!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum