|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
VBScript - General - Question - Javascript function called from button does not work
Hi;
I have a page, not totally written by me, that has several forms on it. I need to do a search from a button next to several form fields. I have the javascript code to call from the onclick of the button. It works fine in my test pages, but in the real page the buttons do not work. I am a db wiz, but I sort of suck on my javascript. Any clues to what might be wrong would be appreciated. I'll be busy removing things from my page piece by piece till I get it right....lol |
|
#2
|
||||
|
||||
|
It's impossible for us to tell without seeing your code...
![]()
__________________
Support requests via PM will be ignored! |
|
#3
|
|||
|
|||
|
Quote:
I tried to post the whole page but the site nixed it for containing urls. Here is the js code and the calls are below. <Script Language="Javascript"> function searchdbp(form) { //Phone FieldVar =form.phone.value; window.location="searchfields_Dot_asp?MyField=Phone&SearchFor=" + fieldVar; } function searchdbc(form) { //Company alert("company"); FieldVar =form.company.value; window.location="searchfields_Dot_asp?MyField=Company&SearchFor=" + fieldVar; } function searchdbct(form) { //Contact FieldVar =form.contact.value; window.location="searchfields_Dot_asp?MyField=Contact&SearchFor=" + fieldVar; } function searchdbe(form) { FieldVar =form.email.value; window.location="searchfields_Dot_asp?MyField=email&SearchFor=" + fieldVar; } </Script> <input name="PButton" type="button" value="Search" onClick="Searchdbp(this.form)"> |
|
#4
|
||||
|
||||
|
I don't know if that's your actual code, or if that's just a typo, but
onClick="Searchdbp(this.form)" won't fire "function searchdbp(form)". ![]() Also, if that is how you're doing your code, it's very convoluted! I'm sure we could help you come up with a more elegant solution. If you could post a link to a page with this code on, that would be great! Just replace the "."s in the link with "dot"s and the forum won't mind www dot google dot com ![]() |
|
#5
|
|||
|
|||
|
Narrowed down the issue
There is one form on the page.
Then another form, my buttons are inside of the second form. When I get rid of the first form, the buttons work. I am wondering if it is related to onclick=(this.form), I'm going to run down the explicit call for the form name. |
|
#6
|
||||
|
||||
|
Are the elements in the same form as the button?
If you can't post a link, can you post the rest of the HTML? |
|
#7
|
|||
|
|||
|
But if anyone wants to look at the actual page email me and I will send you off a copy. gracemgrady "at" cox "dot" net
This code runs on an intranet, so you can't surf to it. It was started by a Romanian firm, taken over by some programmer that just disappeared and now it landed on me. There was also a Russian firm in the mix, but I'm not sure where. I am a database professional and my javascript skills (before this project) were limited to little snippits I change to suit my simple needs, if it's extensive javascript I get someone else to do it. I just want to call a page with a button, but I need the value in the input box when I call the page. I'm searching on the value in the input box. This customer has been through it and deserves a break so I'm trying to get this done myself. And gain enough javascript skills so I don't feel like an idiot every time I see it. Thanks in advance |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > VBScript - General - Question - Javascript function called from button does not work |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|