English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am pretty sure I am calling my .js file correctly, using



and



However, within my .js file, this function works:

function listJob()
{
window.location.href = 'index.php?view=add';
}

But when I modify it to a simple submit, it doesnt work.

function listJob()
{
submit();
}

The above code will not respond (I am trying to submit the contents of a form.. I intend on adding some validation before submitting).

2006-08-24 09:17:05 · 6 answers · asked by Ozone 4 in Computers & Internet Programming & Design

Again, I am calling the file correctly... It just stops working when I change "window.location.href = 'index.php?view=add';" to "submit();"

I would like to know why this is happening.

2006-08-24 09:24:19 · update #1

Guys, I appreciate the effort. I really do. But PLEASE read the question in its entirety first.


Ben : I already mentioned that the .js file is working fine, it is the function that isnt.

computrec: submit(); does not need definition. And I can only assign a type and value to an input.

iyiogrenci: submit(); is not the function. I intend on validating the for within the .js file, if not for that, I would simply say onclick=submit();

rknoblock: I already said I would validate.

2006-08-24 10:30:13 · update #2

6 answers

Hopefully I can end this suffering of miscommunication. You have to tie your submit call to the actual form. It is a method of the form itself.

So lets say your form is named "myform" your listjob() function will need the following...

document.myform.submit();

Notice how you are referencing the form itself and calling its "submit()" method. It will then submit the form to whatever url is in your forms "action" attribute. Here is a greater example...







Hope this clarifies everything! Good luck!

2006-08-24 12:16:11 · answer #1 · answered by Martyr2 7 · 1 0

When a submit button in a form is clicked, it passes the contents of the form to the script or program named in the 'action' attribute of the form tag. I assume your client-side validation would be done in the listJob function and if all is well the submit would be done. If there isn't any client-side validation a plain 'Submit' button would be simpler since it requires no JavaScript.

2006-08-24 10:16:02 · answer #2 · answered by rknoblock 3 · 0 1

i'm having an identical prob too, even if unclear what it fairly is yet Ive got here upon a temp answer. in fact use the internet Explorer upload-on for Firefox. pondering the reality that Firefox 3.0 is new, they in all threat ought to opt to paintings out a malicious application thats all. Take care

2016-12-11 14:42:25 · answer #3 · answered by hayakawa 4 · 0 0

submit function isn't ready.
Try to use submit in a form using input.

2006-08-24 09:51:01 · answer #4 · answered by iyiogrenci 6 · 0 1

You haven't defined the submit(); function.

Try this : type="submit" value="submit"

2006-08-24 09:41:07 · answer #5 · answered by computrec 2 · 0 1

I think your trying to call the file from the wrong sub-directory.

2006-08-24 09:20:55 · answer #6 · answered by watersprings 3 · 0 1

fedest.com, questions and answers