eBook authors eBook Software - create and publish your own ebooks
Create your own eBooks
Learn How To Create, Publish & Market E-Books
E-Book Creation Software
Add sophisticated multimedia to your E-Books
Create E-Book covers in minutes
E-Book Marketing & Promotion made easy
Search engine for E-Books
Interviews with eBook authors
Tools for building better eBooks
Archived Message:

Forms and variables

Dstalter Sometimes I amaze myself at how thick headed I can be. I am using version 4.22.

I am trying to create a form that will allow users to enter 4 or 5 variables. Then open a new page that will display the variables inside text.

For example:
The form can collect name, address, phone, email address.

Then, the following page would insert the variables in text:
Today my name is {name}. Although I live at {address}, I am never there. I could be reached by calling {phone} or by emailing me at {email_address}.

I have printed, read and reread all the ActivScript files. I've made 20+ test eBooks and I just can't get it right.

I named the first file index.html and the second file I tried naming as an .as file and as an .html file. Neither worked.

Would appreciate any help.


Posted on: 9:16 pm on September 9, 2002
Alaska  I was having similar problems figuring out the syntax for Activ variables, until Sunil set me straight.

 Here's a self-contained piece of code that grabs a variable contents, passes it to Activ, and displays the value using the Activ MessageBox().  It then passes the value back to a JS variable, and displays it again in an alert() box.


var xx = 'Hello' ;
window.external.ActivRun("##MESSAGEBOX('variable is {avar}') " );
var yy = window.external.ActivGet('{avar}') ;
alert( "yy is " + yy ) ;


Posted on: 10:33 pm on September 9, 2002
Dstalter Thanks for the reply. I can use that - but not in this case.

I don't want the variables in an alert box, I need it to display in an html page.

At this point, I'd even be happy if someone knows how to use Java to pass variables to a new page. At least I'd understand that!  Well .... maybe not. At this point, I'm not even sure if I could get my name right.    

The purpose of the script is to pass variables into a new page that can then be printed (like a business letter).

Thanks again!

Posted on: 1:18 pm on September 10, 2002
EBookCompiler Can't you use DISPLAY something like

DISPLAY('Today my name is {name}. Although I live at {address}, I am never there. I could be reached by calling {phone} or by emailing me at {email_address}.')

Posted on: 2:04 pm on September 10, 2002
Dstalter Yes, thanks! I think that might work!!

And thanks again to Alaska. That code will be invaluable also.

Posted on: 3:10 pm on September 10, 2002
Alaska My apologies: I assumed (!) familiarity with JavaScript (not Java, mind you - that's a programming language and a stimulating caffeinated beverage).

The example that I posted assigned a word or phrase (a string of characters, called a ‘string’) to a JavaScript variable. Once you have the string in JavaScript, you are free to manipulate it: display it, incorporate it into a URL, whatever . . .

Going back to the example, paste in the extra Html and JavaScript lines shown below to see how it works:


var xx = 'Hello' ;
window.external.ActivRun("##MESSAGEBOX('variable is {avar}') " );
var yy = window.external.ActivGet('{avar}') ;
alert( "yy is " + yy ) ;

Welcome. Your variable is:
<SCRIPT LANGUAGE="JavaScript">document.write(yy);</SCRIPT>


The point of this fragment was to spell out the syntax for handling variables, using both Activ and JavaScript (and, by extension, Html).   Follow the code, and you can see the syntax for using variables in both scripts.

This is what it does:

1) We store the string 'Hello' to the JavaScript variable 'xx' .
2) We assign the string within 'xx' to an Activ variable 'avar'.
3) We display the Activ variable ‘avar’ using Activ's 'Messagebox' function.
4) We assign the contents of the Activ variable 'avar' to the new JavaScript variable, 'yy'.
5) We display the JavaScript variable ‘yy’ using the JavaScript Alert() function.

  ...and, the crucial line you're looking for:

<SCRIPT LANGUAGE="JavaScript">document.write(yy);</SCRIPT>

6) We display the same JavaScript variable in the middle of a bunch of html.

So, your Activ variable value can be passed among pages, and displayed within your Html using JavaScript.

I should add this note: this is merely a demo of bouncing a variable back and forth between script types, and using it in both circumstances.  You don't need to type all this in just to store a value to a variable.   Just use one of the ways in the example: var xx='string', or the ActivSet and/or ActivGet commands.

Further, Sunil's DISPLAY command provides the Activ version of the same thing. Which method you use would most likely depend on what type of script you were building at the time.

I’m sorry I didn’t adequately explain this in the earlier post, and I shall attempt to be more explicit in the future.   You are forewarned.

PS. I added spaces to the first < SCRIPT >, tag, 'cause it wouldn't display intact.  Be sure to remove them if you copy and paste that line.

(Edited by Alaska at 8:28 pm on Sep. 11, 2002)

Posted on: 12:44 am on September 11, 2002


List All Archived Forums

Copyright © 2000-2018, Answers 2000 Limited.

With any business, it is up to the individual owner of said business to ensure the success of the business. You may make more or less than any sample figures or results that might be quoted on our web sites or other publications. All business involves risk, and many businesses do not succeed. Further, Answers 2000 Limited does NOT represent that any particular individual or business is typical, or that any results or experiences achieved by any particular individual/business is necessarily typical.

Disclosure: Our company's websites' content (including this website's content) includes advertisements for our own company's websites, products, and services, and for other organization's websites, products, and services. In the case of links to other organization's websites, our company may receive a payment, (1) if you purchase products or services, or (2) if you sign-up for third party offers, after following links from this website. Unless specifically otherwise stated, information about other organization's products and services, is based on information provided by that organization, the product/service vendor, and/or publicly available information - and should not be taken to mean that we have used the product/service in question. Additionally, our company's websites contain some adverts which we are paid to display, but whose content is not selected by us, such as Google AdSense ads. For more detailed information, please see Advertising/Endorsements Disclosures

Our sites use cookies, some of which may already be set on your computer. Use of our site constitutes consent for this. For details, please see Privacy.

Click privacy for information about our company's privacy, data collection and data retention policies, and your rights.

Contact Us    About and Terms Of Use    Privacy    Advertising/Endorsements Disclosures