Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Design Forum > Web Design & Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Web Design & Programming Discussion of web design, and server-side & client-side scripting

Reply
 
LinkBack Thread Tools
Old 07-18-2009, 09:08 PM   #1 (permalink)
Registered User
 
Join Date: May 2007
Location: British Columbia, Canada
Posts: 53
OS: vista


[SOLVED] Forms

Hi People

Is it possible to invoke a js function on the same page as the form...or do I have to implement the code on a separate page designated with the action tag?

BrentC
BrentC is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 07-20-2009, 10:55 PM   #2 (permalink)
God (TSF Enthusiast)
 
ahmorrow's Avatar
 
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 903
OS: Ubuntu 9.10 [Karmic Koala]

My System

Send a message via AIM to ahmorrow Send a message via Yahoo to ahmorrow
Re: Forms

[code]<a onclick="javascript:JAVASCRIPT CODE HERE;">CLICKABLE LINK</a>
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email.
ahmorrow is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-21-2009, 08:42 AM   #3 (permalink)
Registered User
 
FredT's Avatar
 
Join Date: Nov 2007
Posts: 388
OS: Mac OS X 10.5.7 and XP SP2


Re: Forms

No, no javascript: if you're using an onclick.

Either <a href="javascript:functionCall(params);">Click</a>
or <a onclick="functionCall(params);">Click</a>'

I typically use the first method.

You can definitely use the js on the same page, the action is for server side code (php, asp, etc) needs to be executed.
FredT is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-21-2009, 01:54 PM   #4 (permalink)
Registered User
 
Join Date: May 2007
Location: British Columbia, Canada
Posts: 53
OS: vista


Re: Forms

Yes I got that far...what I want to do though is send info a user enters in a text box in a form.
BrentC is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-21-2009, 03:06 PM   #5 (permalink)
Registered User
 
FredT's Avatar
 
Join Date: Nov 2007
Posts: 388
OS: Mac OS X 10.5.7 and XP SP2


Re: Forms

You need a server side language.

http://www.w3schools.com/php/default.asp
FredT is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-21-2009, 07:32 PM   #6 (permalink)
God (TSF Enthusiast)
 
ahmorrow's Avatar
 
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 903
OS: Ubuntu 9.10 [Karmic Koala]

My System

Send a message via AIM to ahmorrow Send a message via Yahoo to ahmorrow
Re: Forms

Wow, good catch Fred... I really do have to quit coding at well... whatever time that was... EDIT: It was like 2am my time.
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email.

Last edited by ahmorrow; 07-21-2009 at 07:34 PM. Reason: did some math...
ahmorrow is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-22-2009, 03:07 PM   #7 (permalink)
Registered User
 
Join Date: May 2007
Location: British Columbia, Canada
Posts: 53
OS: vista


Re: Forms

That is what I thought, I was hoping a way around php. So I guess I'll have echo a lot of code on the server. Thanks Fred!

Brent
BrentC is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-22-2009, 04:01 PM   #8 (permalink)
God (TSF Enthusiast)
 
ahmorrow's Avatar
 
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 903
OS: Ubuntu 9.10 [Karmic Koala]

My System

Send a message via AIM to ahmorrow Send a message via Yahoo to ahmorrow
Re: Forms

Yeah, I realize what you were trying to do now... I totally screwed that one up lol. Server-Side and Client-Side are sadly different.

An alternative would be to email it instead of using the action method... but I don't know... the problem isn't really clear to me.
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email.
ahmorrow is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-22-2009, 05:51 PM   #9 (permalink)
Registered User
 
Join Date: May 2007
Location: British Columbia, Canada
Posts: 53
OS: vista


Re: Forms

I am displaying Youtube videos. When I use
<a href="javascript:name('theme')">thetheme</a>

that works ok. But I want to also have the user enter any theme in a text box in a form. That does not work. Like Fred said I'll have to go to a (in my case) php page and generate the js from there.

The Youtube API comes with js link as well.

Check out my page here:



As you will see, clicking on a preset theme works - some videos with the theme are presented. But not if you enter a 'custom' them.
BrentC is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-22-2009, 06:25 PM   #10 (permalink)
God (TSF Enthusiast)
 
ahmorrow's Avatar
 
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 903
OS: Ubuntu 9.10 [Karmic Koala]

My System

Send a message via AIM to ahmorrow Send a message via Yahoo to ahmorrow
Re: Forms

Ummm... I don't see a link 0.0
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email.
ahmorrow is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-22-2009, 07:14 PM   #11 (permalink)
Registered User
 
FredT's Avatar
 
Join Date: Nov 2007
Posts: 388
OS: Mac OS X 10.5.7 and XP SP2


Re: Forms

No, not necessarily, you can use js to get data from the form. I thought you were trying to send it to a database or email it or something. If it's staying on the page, that's fine.
Code:
<form onsubmit="name(document.getElementById(searchbox))">
     <input type="text" id="searchbox" />
     <input type="submit" value="Submit" />
</form>
Does that make sense?
FredT is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-23-2009, 04:13 PM   #12 (permalink)
Registered User
 
Join Date: May 2007
Location: British Columbia, Canada
Posts: 53
OS: vista


Re: Forms

That is still not working...I'll try putting the link to my page here again

http://24.67.40.54/youtube/enter_content.html
BrentC is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-23-2009, 06:12 PM   #13 (permalink)
Registered User
 
FredT's Avatar
 
Join Date: Nov 2007
Posts: 388
OS: Mac OS X 10.5.7 and XP SP2


Re: Forms

Sorry

Code:
<form onsubmit="name(document.getElementById(searchbox).value)">
     <input type="text" id="searchbox" />
     <input type="submit" value="Submit" />
</form>
FredT is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-23-2009, 07:25 PM   #14 (permalink)
Registered User
 
Join Date: May 2007
Location: British Columbia, Canada
Posts: 53
OS: vista


Re: Forms

Thanks but it still doesn't work...
BrentC is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-23-2009, 08:53 PM   #15 (permalink)
God (TSF Enthusiast)
 
ahmorrow's Avatar
 
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 903
OS: Ubuntu 9.10 [Karmic Koala]

My System

Send a message via AIM to ahmorrow Send a message via Yahoo to ahmorrow
Re: Forms

Typing in the name of the variable (video?) would need to be case sensitive. So This != this. You'd need to be sure to type everything into that box exactly.
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email.
ahmorrow is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-23-2009, 09:08 PM   #16 (permalink)
God (TSF Enthusiast)
 
ahmorrow's Avatar
 
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 903
OS: Ubuntu 9.10 [Karmic Koala]

My System

Send a message via AIM to ahmorrow Send a message via Yahoo to ahmorrow
Re: Forms

Code:
<a href="javascript:OnLoad('ads')" style="position:absolute; top:100; left:100">ADS</a>
Question... why are you calling a text string with an onload statement? and why are you using a link?

It just doesn't make sense to me.

Code:
<form>
<input size="25" type="text" id="myText" value="vw">
<input type="button" value="Select text" onclick="OnLoad()"> 
</form>
Especially when the form is doing the above. Wouldn't it be something more like:

Code:
<form>
<input size="25" type="text" id="myText">
<input type="button" value="Select text" onclick="OnSubmit('document.getElementById(myText)')"> 
</form>
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email.
ahmorrow is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-23-2009, 09:36 PM   #17 (permalink)
Registered User
 
FredT's Avatar
 
Join Date: Nov 2007
Posts: 388
OS: Mac OS X 10.5.7 and XP SP2


Re: Forms

My code should definitely be working. Could you put it back in so I can see it in the site and tell what's going wrong? What you have now makes no sense.
FredT is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-23-2009, 09:42 PM   #18 (permalink)
Registered User
 
Join Date: May 2007
Location: British Columbia, Canada
Posts: 53
OS: vista


Re: Forms

Ok I've got it working now...The OnLoad was a my function name (not to confuse it with onload=name() in a body tag.)

I tried what you and Fred said and it did not work. But after some perseverence I got it working. As I said above I want the user to enter a 'theme' for the videos on the right.

Here is the form code...

<form id="myText" >
<input size="25" type="text" name="me" value="beer" /><br />
<input type="button" value="Select text" onclick="mytheme()">
</form>

I changed the function name to mytheme. Then I added some simple js to detect if the mytheme function is being passed a preset theme or a 'custom' theme.

Thanks for your efforts guys...I will probably need you in future. It's good to have people who know this stuff to bounce off...

Brent
BrentC is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-23-2009, 09:46 PM   #19 (permalink)
Registered User
 
Join Date: May 2007
Location: British Columbia, Canada
Posts: 53
OS: vista


Re: Forms

Here is the file:

24.67.40.54/youtube/enter_content.html
BrentC is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-23-2009, 11:53 PM   #20 (permalink)
God (TSF Enthusiast)
 
ahmorrow's Avatar
 
Join Date: May 2009
Location: Jeffersonville, IN
Posts: 903
OS: Ubuntu 9.10 [Karmic Koala]

My System

Send a message via AIM to ahmorrow Send a message via Yahoo to ahmorrow
Re: Forms

Yeah, I was thinking onload was a reserved word that you can't use as a variable/function. Could be wrong, but that might've been it.

Oh well, seems to be working if a bit messed up looking in Firefox. The title is covering the button/textbox and the links are smudged in there too.

Glad it worked out, if you could go up to Thread Tools at your first post, and select "Mark Post As Solved" or whatever it is.
__________________
If I have not responded to a post in 24 hours or more, PM me with a link to the thread and I'll get back to you. I do not help via PM/IM/Email.
ahmorrow is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 04:31 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85