Click to See Complete Forum and Search --> : How to Activate a Form Remotely


txyaaj
10-31-2005, 09:43 AM
I have created a form on a page, is there a way to activate that form from another location through codes?

Let's say I created a "View Results" form on page 1 then do some stuff on page 2, which then includes a command to activate the "View Results" form from page 1, etc.

Thanks in advance...

Tou Yang
Wisconsin

ray326
10-31-2005, 01:39 PM
Define what you mean by "activate."

txyaaj
10-31-2005, 05:32 PM
What I meant was like an analogy to a function, which I want to be able to call the function (form in this case) from another page or specifically from a drop-down menu item. I could do it at this point, but I had to recreate the form inside the menu, which essentually duplicates the button/image on the menu. I could live with that but I was hoping there's another way of doing it such assign an onClick event to just the menu caption so it doesn't look so gaudy.

ray326
10-31-2005, 10:01 PM
Sorry to be so dense but I'm still not getting it. Maybe someone else does or you can try restating it again a different way.

txyaaj
11-01-2005, 07:19 AM
Ok, I was comparing Javascripting/HTML to something like what you could do in VB. In VB once you created a function/subroutine, you could assign that module to a menu item or invoke it from any where by calling the module.

Is that possible in Javascripting? Right now I got it to work but not by calling the "form" previously created in another page but by recreating the form (button) inside the menu as seen in the first item of the attachment. I would prefer to use the second item and assign an onClick event to that instead of using the button...

ray326
11-01-2005, 04:34 PM
It just looks like a drop down menu to me. The look of it can be controlled with CSS and the behavior with Javascript.

txyaaj
11-01-2005, 06:22 PM
Exactly - it's a drop-down menu with the form code creating the button as a menu item instead of a text caption. You said the button's look could be controlled by CSS or Javascript does that mean there's no way to assing an onClick property to a text caption of "View Results" so that it will invoke the form created elsewhere?

MstrBob
11-01-2005, 07:35 PM
Are you asking if you can add 'onclick' to something other than a button? Yes, you can. Check out the documentation for the onclick attribute (http://www.w3.org/TR/html4/interact/scripts.html#adef-onclick). You can add it to most elements. Like:


<span onclick="viewResults():">View Results</span>

txyaaj
11-02-2005, 06:58 AM
Yes, something like that. I tried a few things but it didn't work. Now I think I will have to find a way to write the function which contains the "view results" codes so that when I click on the menu item the function would fire up... :rolleyes:

Thanks-MstrBob

kelly23
11-02-2005, 07:52 AM
You can create the javascript in a .js file (no opening and closing script tags) and name it view_results.js, then place a reference to it in the head of each page where you want to use it:

<head>
<script language="javascript" type="text/javascript" src="view_results.js"></script>
</head>


Then, call it from a text link or whatever.

kelly

Edit: Call the function from a text link.

txyaaj
11-02-2005, 08:10 AM
Thanks Kelly, I will give that a try....