tport_rti
asked on
Submit HREF help!
I am sure this has been asked 1,000,000 times. It is a tired question. That said I still can't find the answer I'm looking for...
I'm trying to submit a page using a href and nothing I do submits it. I have tried so many things I'm now so confused I'm of no use!
Here's snippets of the form... I have a link to save in the middle of the form b/c it's such a long form. Therefore I also have THREE submit buttons.
I'm trying to submit a page using a href and nothing I do submits it. I have tried so many things I'm now so confused I'm of no use!
Here's snippets of the form... I have a link to save in the middle of the form b/c it's such a long form. Therefore I also have THREE submit buttons.
<head>
<SCRIPT LANGUAGE="JAVASCRIPT">
// I'm including this function in case this could be causing the problem
function checkLength(form){
if (addFrm.comments.value.length > 5000){
alert("Please limit comments to 5000 characters.");
return false;
}
if (addFrm.summary.value.length > 20){
alert("Please limit comments to 5000 characters.");
return false;
}
return true;
}
</SCRIPT>
<style><!--- this is just a portion of my .css but it's the part that contains the style for this td --->
}
a.TopRightAnchor_Save:link, a.TopRightAnchor_Save:visited {
background-image: url(../images/Btn_Save.gif);
}
a.TopRightAnchor_Save:hover {
text-decoration: none;
background: url(../images/Btn_Save_OVER.gif) no-repeat;
border: 1px dashed #777;
}
</style>
</head>
<form method="post" action="act_submitReport.cfm" name="addFrm" id="addFrm" passthrough ="HTML_attributes" enctype="multipart/form-data" onSubmit="return checkLength(this)">
...bunch of fields...
<link I need to submit - I do not have any submit code in here right now b/c nothing I tried works, but I tried various onClick Submit functions>
<td><a class="TopRightAnchor_Save" style="float: right; margin-left: 0;" href="">Save</a></td>
<input type="submit" value=Submit"> <input type="submit" value="Save">
</form>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks... You would think that would work... I've tried that and other variations... I get an error:
Line: 374
Char: 1
Error: Object doesn't support this method or property.
Code: 0
I do not know why. I have a lot of other javascript in the form... but when I take this out I don't have any errors.
Line: 374
Char: 1
Error: Object doesn't support this method or property.
Code: 0
I do not know why. I have a lot of other javascript in the form... but when I take this out I don't have any errors.
What browser are you using? I've tested the above in FF3 and IE7 and it works fine. Did you try the second example I gave?
You could change the document.form.element to getElementById's to see if that works?
You could change the document.form.element to getElementById's to see if that works?
ASKER
IE 7...
Could the other javascript I have in here be blowing it up? I have a ton...
in one section:
Could the other javascript I have in here be blowing it up? I have a ton...
in one section:
<tr>
<th class="ON" id="firstTab" style="border-left: 1px;"><a HREF="javascript:void(0)" name="contact" onClick="setActiveTab(this.parentNode); hideAll(); changeDiv('contact1','block');"><strong>Primary Contact</strong></a> </th>
<th class="OFF"><a HREF="javascript:void(0)" name="contact" onClick="setActiveTab(this.parentNode); hideAll(); changeDiv('contact2','block');"><strong>Contact 2</strong></a> </th>
<th class="OFF"><a HREF="javascript:void(0)" name="contact" onClick="setActiveTab(this.parentNode); hideAll(); changeDiv('contact3','block');"><strong>Contact 3</strong></a> </th>
<th class="OFF"><a HREF="javascript:void(0)" name="contact" onClick="setActiveTab(this.parentNode); hideAll(); changeDiv('contact4','block');"><strong>Contact 4</strong></a> </th>
<th class="OFF"><a HREF="javascript:void(0)" name="contact" onClick="setActiveTab(this.parentNode); hideAll(); changeDiv('contact5','block');"><strong>Contact 5</strong></a> </th>
</tr>
and in an include with a bunch of other functions...
function confirmSubmit()
{
var agree=confirm("Click [OK] to continue without saving or [CANCEL] to exit request and save.");
if (agree)
return true ;
else
return false ;
}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=420,height=200,left = 362,top = 234');");
}
function confirmSubmit2()
{
var agree=confirm("This follow-up has been saved in the system. \n Please save your work before removing a previously saved follow-up. \n Click [OK] to continue or [CANCEL] to exit request and save.");
if (agree)
return true ;
else
return false ;
}
function confirmSubmit3()
{
var agree=confirm("This link has been saved in the system. \n Please save your work before removing a previously saved follow-up. \n Click [OK] to continue or [CANCEL] to exit request and save.");
if (agree)
return true ;
else
return false ;
}
function confirmSubmit4()
{
var agree=confirm("This upload has been saved in the system. \n Please save your work before removing a previously saved follow-up. \n Click [OK] to continue or [CANCEL] to exit request and save.");
if (agree)
return true ;
else
return false ;
}
function ShowDiv(id)
{
if (document.getElementById(id))
{
document.getElementById(id).style.display = 'block';
}
}
function HideDiv(id)
{
if (document.getElementById(id))
{
document.getElementById(id).style.display = 'none';
}
}
function ShowHideDiv(id)
{
obj = document.getElementsByTagName("div");
//alert ("got to showHide - " + id + " - " + buttonName + " - " + group);
if (obj[id].style.display == 'block')
{
HideDiv(id);
}
else
{
ShowDiv(id);
}
}
hmmm if its just this function that is erroring just the amended one below (adding the actual id's to your form elements of course). and then doing the href and onclick from my second example above:
function checkLength(){
if (document.getElementById('comments').value.length > 5000){
alert("Please limit comments to 5000 characters.");
return false;
}
if (document.getElementById('summary').value.length > 20){
alert("Please limit comments to 5000 characters.");
return false;
}
document.addFrm.submit();
}
your function expects a form object. Try:
<td><a class="TopRightAnchor_Save" style="float: right; margin-left: 0;" href="#" onclick="if( checkLength( document.getElementById('addFrm') ) ){ document.getElementById('addFrm').submit(); }">Save</a></td>
IMPORTANT: make sure there is NO element with
id="submit" and/or name="submit". If there is, you need to change the id and/or name.
ASKER
I have an input further down that is a submit - two in fact. I need to this save in the middle of the page b/c - well, the user requested it - but also it's a long form. So which name would I change? If I change the actual input submit, they won't submit... no?
<input type="submit" value=Submit"> <input type="submit" value="Save">
<input type="submit" value=Submit"> <input
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Still doesn't work for me but it appears to be something in my additonal code. Hope you don't mind I split the points between you two. Thank you for toughing it out with me!
should do the trick :)
Open in new window