This is a discussion on "Problem: onClick Function" within the Web Page Design section. This forum, and the thread "Problem: onClick Function are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
Problem: onClick Function
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Hello All,
My first post in this forum. I have made a general contact us module based in html/and table for Joomla. I have added verification and CAPTCHA. but the problem i am facing is that, for the submit button i need to give a 3 commands to make them work properly, i.e. unless the person has entered the cumpolsary fields he wont be able to send the mail. But the problem is the onclick command is parsing only the first of the attributes. Here is the php code.
mihir. |
|
|
|
#2
|
|||
|
|||
|
Re: Problem: onClick Function
I recommend removing your onclick to the .js javascript file itself. Delete it from the HTML, and write this in the javascript:
|
|
#3
|
|||
|
|||
|
Re: Problem: onClick Function
Hello,
thanks for the reply. Just one thing, while defining it in the js where shall the return tag come? I added this, just as you suggest (i hope so...)
missing ( before formal parameters thanks, mihir. Last edited by mihirc; Jul 26th, 2007 at 10:47. |
|
#4
|
|||
|
|||
|
Re: Problem: onClick Function
Quote:
|
|
#5
|
|||
|
|||
|
Re: Problem: onClick Function
Ok,Just to explain you better...
The mailIt function sends a mail to a defined email id. And the checkform validates the form. SO what i want is unless the form is validated the mail shouldnt be going. If i keep the mailIt function before, then it is checking the form and giving the correct error, but it is also sending the mail, which i dont want. mihir. |
|
#6
|
|||
|
|||
|
Re: Problem: onClick Function
And after using ur suggested correction,
I came across this error... document.getElementById("submit") has no properties Sorry For Putting you through all this trouble... mihir. |
|
#7
|
|||
|
|||
|
Re: Problem: onClick Function
Quote:
I think that means it's failing to find the element with that ID. Not sure why this is happening, but at least you can add an object detect to avoid the error:
This may not actually make it work, but at least it will stop the error message (for pages that lack this element). |
|
#8
|
|||
|
|||
|
Re: Problem: onClick Function
Hi.
well id did avoid the error, but then it disabled both the scripts from working. you can take a look at the live site.. www.dev003.tekdi.com Its a quarter past 6 here... and am going to stay up all night to solve this... My trial and error is getting me to nothing but sheer, desperation. mihir. |
|
#9
|
|||
|
|||
|
Re: Problem: onClick Function
Quote:
Your site's XHTML code is a horrible mess of errors. Fix them all: http://validator.w3.org/ |
|
#10
|
|||
|
|||
|
Re: Problem: onClick Function
I know know,
this is joomla based site... mihir. |
|
#11
|
|||
|
|||
|
Re: Problem: onClick Function
Sorry, but I'm not willing to debug any website that has a large number of known errors. I don't have any skills with manipulating junk code; it's a black art. I left that behind years ago.
If joomla creates junk code, then you must deal with the consequences |
|
#12
|
|||
|
|||
|
Re: Problem: onClick Function
The other alternative is to use the return checkform() method but add more code to the JS function
so
[code]onclick="return checkForm(this.form, ';');"[/cpde] then your function would look like
|
|
#13
|
|||
|
|||
|
Re: Problem: onClick Function
Hi,
thanks for the reply... Here is what i did as you suggested (putting up the whole code...)
mihir. |
|
#14
|
|||
|
|||
|
Re: Problem: onClick Function
well there are so many things wrong with that code that i'm not even gonna attempt to put the problems here. Give me 5 mins i'll rewrite it for you
Right well I cant test the code fully (as I dont have all the functions and PHP classes) but this should work
Last edited by Paramiliar; Jul 27th, 2007 at 10:17. Reason: added code |
|
#15
|
|||
|
|||
|
Re: Problem: onClick Function
Hi,
wow cool... Would you like to check the javascript and the send.php file also? so that it could be easier for you to take a look... you are being great help... mihir. |