Saving a variable,just one line of text, by any means necessary!

advanced-prototyping

#1

I am building a “what career is most suitable for you” prototype that asks the users a series of questions and boils down to provide one answer.

The final page displays one of twenty potential outcomes, displaying variable careerRecomendation. (Which uses logic based on the questions to determine “engineer”,“fireman”, etc.

Is there ANY WAY to save that one line text.

Some crude workarounds I imagine might be possible:
-Any way to export it to a text file and upload it to a server.
-A widget that can screen capture the final screen and upload it to a server

Please help!

Thanks,
John


#2

what is the further usage? storing it without personalisation, storin with personalisation, with or without restoring on the client-side?

anyway…

you can open a external url… http://www.myserver.com?string=yourResultString

what your server does with the string is on you. you can store it into a textfile, add to a mysql or whatever. If you want to show a previous result on the client-side you will have to use a way to identify the user and to find a way to send it back… the best in the other direction will be a ajax-request to your server-sided script.
you have to take in reconsideration, that you are not able to set a global axure variable from javascript without some modification to the axure scripts. you can use a workaround a nd use a rectangle to send the text to and to move it to make it set a variable value.

$axure(’@rect’).text(returnedValueFromAjax);
$axure(’@rect’).moveBy(0,0,{});

and in Axure rect.onMove(this) {
globalVariable = this.text;
}

To identify users you can for example use a $_GET()-Variable as parameter (send a Email-invitation with a personalised link).

In fact it is no rocket science.


#3

Thanks for the reply Gregor,

The ability to store with personalization and restore data would be ideal. I’m far from an expert and correct me if i’m wrong but here is what I’ve gathered:

-From the axure side, I can create a create a button which (when clicked) will open an external link that sends the string to the server. Assuming I have the user log-in with an email (string), I can have the button send the careerRecommendation (string) and logInName (string) to the server, which will store that data together. The server can name the text file as logInName.txt, which contains the careerRecommendation (string)

-Say the user returns using an email address (string) to log in. I would create a button(rectangle) that sends logInName(string) to the server and looks for a matching careerRecommendation(string) by searching for logInName.txt. Because global variables can not be set via javascript, I need to set an action to the rectangle in order for the rectangle to store the value as a global variable.

Does this sound about right? Do you by chance have an example that you could publish that does something similar?

Much appreciated,
John

EDIT: P.S - I just downloaded mysql / mysql workbench and am getting oriented, as it seems that might be a more convenient way to store/ manage data.


#4

be aware of cross domain policies, this might cause problems.

i stored a working example here to keep you inspired.

for some reason it sometimes seems to need a reload.


#5

Thank you, this is very helpful. Appreciate you going out of your way to create that. Is there any way you could post the .rp file?

Thanks,
John


#6

I’ve been at this for about a month and haven’t had any luck. The provided example demonstrates exactly what I am trying to do, could you post the .rp file, or further explain how to approach this? Thanks!


#7

the magic is not the rp. the magic is the server-client architecture to avoid violating cross domain policies, a little php to store and provide the data and a little part of rp to get the value (sending is extremely simple).
even if i post the rp it might not help to solve your problem.

attached you find a zip with all files. the folder-name jsTest is incorrect, it should be something like serversided…
store.zip (494 KB)


#8

Thanks so much Gregor, you rock.


#9

Once uploaded to axshare I have no idea how the project is structured. (Whereas from generating a local prototype I have access to see how it is packaged/ folder hierarchy).

Does the entire project structure change once uploaded to Axshare? Is there any documentation on how it is packaged?

Thanks,
John


#10

It won’t work on Axshare. You won’t be able to write to the filesystem and you won’t be able to run PHP code.


#11

Gotcha, will have to host on a local server. Thanks for the clarification.


#12

So If I were to host the php and txt file on my server, Can I still use this method with Axshare?


#13

I have a question
I used your project but when i generated the html files again in axure 8
It is not setting any text in $axure(@returen).text
I think we dont refer in axure 8 like this
What is your suggestion ? Any idea ?
How to set the text in return widget.
I tried to set static text as well but it is not setting anything
In the function getvalue @Gregor plz help


#15

Gregor, this link os broken!! :thinking:

“I stored a working example here… to keep you inspired”.