# How to make a CDF document with dynamic content?

I would like to create a CDF document that uses dynamic content. The example code is:

fun=x^2-1;
InputField[Dynamic[fun]]


And what I get is \$Aborted instead of interactive document. How to make a useful document?

EDIT:

What I am really trying to do is to make a CDF document in which the given function is plotted. Initially the function is x^2-1, but the user should be able do input any function.

-

Actually doing

CDFDeploy["test.cdf", Manipulate[
Plot[fun, {x, 0, 10}],
{fun, x^2 - 1}], Method -> "Standalone"]


you will see that the FreeCDF will not let you do what you want, i.e., some interaction like you get in normal Mathematica by:

Manipulate[
Plot[fun, {x, 0, 10}],
{fun, x^2 - 1}]


Check out the differences between FreeCDF and Enterprise CDF http://www.wolfram.com/cdf/adopting-cdf/licensing-options.html

The important little detail is "arbitary input fields": this is just not enabled in FreeCDF. So, it looks like you have to get Mathematica Enterprise in order to produce EnterpriseCDF's.

Oh, and don't forget to "Contact the CDF Team" : http://www.wolfram.com/cdf/contact-us/

-
Well... that is a pity, but I don't think that I will spend 5,6k pounds just to let my students make interactive plots :p So the question is: what can I do with Standard edition? – Misery Jan 4 at 12:04
@Misery, the differences is shown in this link: wolfram.com/player-pro/how-player-pro-compares.html . One main difference is that free CDF does not allow input of any input. ie. you can input numbers only, but nothing else via the inputField. I do not think this is a problem for education demos. You provide pull-down menus, sliders, and such for user input. Free form input is not really that important in many cases for students. Getting free form input also means the student will have to parse the input to validate it. So it is really simpler to use menus and sliders and such. – Nasser Jan 4 at 12:15
and to answer your question about what can I do with Standard edition?, well, here are about 8,500 examples of what you can do demonstrations.wolfram.com – Nasser Jan 4 at 12:18
So... If I made an application in Mathematica, it would be useful only if someone had CDF-pro or if I made those CDF files using Enterprise edition of Mathematica. Am I right? – Misery Jan 5 at 8:53
I cannot find any official information for the situation in Mathematica 9. Maybe Andre or someone else officially from WRI can answer... It seems unclear right now. – Rolf Mertig Jan 5 at 21:21

This may do what you want:

InputField[Dynamic[x, (x = #^2 - 1) &]]

-
 That looks nice, but only for functions like x^2-1. But what if I would like to put there any function. – Misery Jan 4 at 10:38 (x = f[#])& is also OK, assuming that you have defined the 1-argument function f elsewhere. – Stephen Luttrell Jan 4 at 10:54 Thank you! Your answer is very good. I just wasn't aware of limitations of CDF files :( – Misery Jan 5 at 8:50