Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what am I doing wrong in this form declaration

Status
Not open for further replies.

786snow

Programmer
Nov 12, 2006
75
Hi,

what am I doing wrong here, i noticed even If I comment out code in my function, my form gets submitted> i am puting code for form delaration, submit button and my function.

********************


<FORM ACTION="/NASApp/EDocsCtx/EDocsConsentServlet" METHOD="POST" NAME= "DeliveryOptions">



<input ONCLICK="javascript:updateConsent(this.form);" TYPE="image" VALUE="submit" NAME="next" SRC=" />

function updateConsent(ref) {
//func_validateEmail()


//ref.next.value = 'continue';
// ref.submit();
}

******************************
 
I don't think you need the javascript psuedo-protocol in an onclick event. Just call the javascript function.
I don't know if that call is correct actually.

Also, your javascript function seems to contain just 3 comments. What did you want it to do and what is actually happening?

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
This is more of a javascript issue. For starters put
alert boxes in your function and try to trace what gets executed when you have that code commented out.

Foamcow is right when he says you don't need the psuedo-protocol, and assuming this input box is between the <form> tags, what you have should work, but this is cleaner:
Code:
<input onclick="updateConsent(this.form)" .....

Something else I notice, I see you have a function call to validate your email.

You should have a return value assigned to that function based on if the email is valid or not. As is, if invalid email is incurred, the form will still submit.

Assume email is valid, you want to return true.
Code:
if (func_validateEmail()) {
   //go ahead and submit form
}




[monkey][snake] <.
 
Ok, I stripped down the code so I can past it here, why is there is no submit but still when i click on the button , forms gets submitted.

******************
<HTML>
<HEAD>
<TITLE></TITLE>

<script LANGUAGE="Javascript" >


function test() {

alert("testingggggggggggg");
}


</script>


</HEAD>


<BODY >

<TABLE BORDER=0 WIDTH="730" CELLPADDING=0 CELLSPACING=0>
<TR>
<TD>
<FORM ACTION="/NASApp/EDocsCtx/EDocsConsentServlet" METHOD="POST" NAME= "DeliveryOptions" >

<TABLE BORDER=0 WIDTH="730" CELLPADDING=0 CELLSPACING=0>
<TR>
<td valign="middle" nowrap><br><b>E-mail address</b>:&nbsp;
<input type="text" name="email" size="40" value="" maxlength="40"/>
</td>
</tr>
<tr>
<td align=center colspan="3">
<input ONCLICK="test();" TYPE="image" VALUE="submit" NAME="next" SRC=" />
</td>
</tr>
</FORM>
</table>
</td></tr></table>
</html></body>

********************
 
Here you go, straight from the horse's mouth W3C:

Image Pixel: INPUT TYPE=IMAGE
An INPUT element with `TYPE=IMAGE' specifies an image resource to display, and allows input of two form fields: the x and y coordinate of a pixel chosen from the image. The names of the fields are the name of the field with `.x' and `.y' appended. [!]`TYPE=IMAGE' implies `TYPE=SUBMIT'[/!] processing; that is, when a pixel is chosen, the form as a whole is submitted.

The NAME attribute is required as for other input fields. The SRC attribute is required and the ALIGN is optional as for the IMG element (see section Image: IMG).

For example:

<p>Choose a point on the map:
<input type=image name=point src="map.gif">


From this site:



[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top