I am attempting to create a textbox to enter some emails, then use a button to call a javascript function. Then function then checks for yyy.com in each address, and if incorrect issues an alert, if correct it does a submit(). However, once submitted, I am unable to read the POST value and name of the button, which I need. If I just create a regular submit button without the javascript, everything works fine. I can’t figure out why the value and name aren’t being sent, when the javascript shows them as being correct. This is being page is being written with REXX on z/VM, hence all the queues.
queue ‘<FORM NAME=”ECCN” ACTION=”../software/ECCNlist.wrkvmgw” METHOD=”POST”>’
queue ‘<input type=”text” name=”maillist” MAXLENGTH=200 SIZE=50>’
queue ‘<input type=”button” value=”Email List” name=”InpAction” onClick=”javascript:check_mail(this.form);”>’
queue ‘</FORM>’
function check_mail(form)
{
var maillist = form.maillist.value;
maillist.toLowerCase();
var index = 0;
var invalid_mail = ”;
var mailarray = maillist.split(” “);
while (index < mailarray.length) {
if (mailarray-index- != ” && mailarray-index-.indexOf(‘yyy.com’)
{
invalid_mail = invalid_mail+mailarray-index-+’ ‘;
}
index+=1;
}
if (invalid_mail != ”) {
alert(“Invalid email address(es):n”+ invalid_mail);
}
else {
alert(document.ECCN.action); /* This is assigned correctly
alert(document.ECCN.method); /* This is assigned correctly
alert(document.ECCN.InpAction.name); /* This is assigned correctly
alert(document.ECCN.InpAction.value); /* This is assigned correctly
document.ECCN.submit(); /* Does submit to the correct action
}
}
Again, the javascript seems to work correctly, but when I read the POST variables in, value=”Email List” name=”InpAction” are no where to be found.
This is how they are read in using REXX:
‘CGI READ 1 (TRANSLATE USENGLISH VAR ARGSTRING’
‘CGI URLDECODE (VAR ARGSTRING INTO PARMS.’
InpAction = strip(parms.InpAction) /* InpAction should = “Email List” , but is not assigned to anything