Think of something that you wish Authorware could do but it doesn't?  Let the our good friends at Macromedia know via the wishlist.

Please let us know if you find any of the materials on this site inappropriate or offensive. Please include the url and why the material should be reviewed.

Comments and questions about the site are also welcome. Please no Authorware questions, use the AWARE list.

Back

B7001 - How can I keep track of a user's entries in a form? [includes a short discussion of lists and property lists]

by - Joseph Ganci


I have a series of text entry interactions for filling out a form. Each interaction is in a map hanging off a framework. I name each map/page on the framework a different variable name and set vCurrentVar:=IconTitle in an ornamental calc on each map. Then I use the same interaction inside each map where a text entry response exists with a calc where I would like to use "SetVariable(EntryText, vcurrentvar)" to assign the user reponses, but I know that only works in KOs. I'm new to using EvalAssign() and from what I read, I'm not sure if I can do what I want to do here. Can anyone lend me some guidance here?

Here are three options.

OPTION 1. You need to make sure that the variables that are represented by the icon titles already exist in your file. Authorware will not create them on the fly by using the approach you're attempting.

Then you CAN use EvalAssign, like so:

EvalAssign(vcurrentvar ^ " := EntryText")

OPTION 2. You may be better served by using a linear list here. If you want to use a linear list, you can set the location in the list to be equivalent to the framework page number, and store your entrytext value there. For example,

values[CurrentPageNum] := EntryText

in the text entry response's calc feedback will store the user's entry in the location in the list (called "values") that is represented by the page the user is currently in. If the user has gone through three pages, and typed "one", "two", and "three" on each page, respectively, then the list values will contain:

["one", "two", "three"]

Note that in this case, you don't have to worry about the vCurrentVar variable or setting it anywhere. You can get rid of it. Do remember to initialize values as [] earlier in your file. Note that this eliminates all those variables that you have to have in option 1.

OPTION 3. If the names of the pages really do matter for some reason (and they really shouldn't if you set up your code right), then you can use property lists instead. In this case, keep the vCurrentVar:=IconTitle statements that you have now. You can then use in your response calcs:

AddProperty(values, Symbol(vcurrentvar), EntryText)

Your property list values will contain

[#page1:"one", #page2:"two", #page3:"three"]

Do remember to initialize values as [:] earlier in your file. Again, you don't need to worry about variables here. However, make sure the icon titles you are using start with an alphabet character, not a number, and that you don't use spaces. If you do use spaces, the property names will only include the characters up to the first space.

There you go, three options, in increasing order of complexity. Note however that with each higher order of complexity comes also a higher degree of maintainability. In Option 1, you have to worry about a lot of variables. In Option 2, you eliminate the variables but may have a problem if you delete or add pages and are trying to carry over values from old sessions. In Option 3, you have neither worry.

There are 0 reviews
Add your review
Back