/    Sign up×
Community /Pin to ProfileBookmark

form.submit(); – Object Doesn’t Support This Property Or Method…HELP

Hi There,

I am getting this error message every time I try to submit my form. The form values are then passed to my PHP script to process the data into the database. I have checked my code to make sure I am not using ‘submit’ anywhere. Anyone got any ideas? I’ll post my code.

[CODE]
<script language=”JavaScript” type=”text/javascript”>
<!–

function checkform ( form )

{

if (document.getElementById(“user_id”).value.length <3) {
alert( “Please Enter Your User ID” );
document.getElementById(“user_id”).focus();
return false ;
}

if (document.getElementById(“request_title”).value.length <3) {
alert( “Please Enter a Request Title” );
document.getElementById(“request_title”).focus();
return false ;
}

if (document.getElementById(“fault”).value.length == 0) {
alert( “Please Enter Details Of The Fault” );
document.getElementById(“fault”).focus();
return false ;
}

document.getElementById(“submitButton”).disabled = true;

form.submit();

return true ;

}

//–>
</script>

</head>
<body>

<div align=”center”><h2>Submit Request</h2>

<p>You must be registered before you can submit a request. Use the link below to register.</p>

<a href=”create_user.php”>Not Registered </a>

</div>
<form name=”request_form” method=”post” action=”submit_request_processing.php”>

<fieldset>
<legend>Contact Details</legend>
<p>
<label for=”user_id”>User ID:<em class=”required”> (Required)</em></label>
<input name=”user_id” id=”user_id” type=”text” maxlength=”6″/>
</p>

<p>
<label for=”request_title”>Request Title:<em class=”required”> (Required)</em></label>
<input name=”request_title” id=request_title” type=”text” maxlength=”30″/>
</p>
</fieldset>

<fieldset>
<legend>Request Details</legend>
<p>
<label for=”fault”>Fault:<em class=”required”> (Required)</em></label>
<p>
<table width=”400″>
<tr>
Please provide as much information about the fault as you can i.e. Workstation Numbers, Serial Numbers.
The more information you provide the quicker a technician can get round to seeing you and solving your request.
</tr>
</table>
<textarea name=”fault” id=”fault” type=”text” cols=”50″ rows=”10″/>
</textarea>
</p>
<input type=”reset” name=”reset” value=”Reset” />
<input type=”button” name=”submitButton” onclick=”checkform(this)” id=”submitButton” value=”Submit”/>
</fieldset>

</form>
[/CODE]

Thank you ?

Danny

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Nov 10.2006 — onclick="checkform(this)"

You are passing a reference to the button to the function not the form.

this.form is probably what you are after.

Eric
Copy linkTweet thisAlerts:
@dangillowauthorNov 10.2006 — onclick="checkform(this)"

You are passing a reference to the button to the function not the form.

this.form is probably what you are after.

Eric
[/QUOTE]


I made the change, I think.

[CODE]<input type="button" name="submitButton" onclick="checkform(this.form)" id="submitButton" value="Submit"/>[/CODE]

After clicking submit it goes to the next page but nothing happens. When it should insert the form values into the database. I've tested the page is working with another script.

Thanks

Danny
×

Success!

Help @dangillow spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...