I wrote a function and saved it in a package. I saved a copy of the package in the Autoload folder too. I deployed a CDF that contains this function. When I open the CDF later, this function (which represents modified input fields) is not evaluated. But when I do any operation that evaluates this function (like a button click), it gets evaluated and the cdf works just fine.
I am using Mathematica 9 to deploy the cdf and also to run it to check it.
Updated, the package's code down below -
BeginPackage["ModifiedInputFields`"] InputFieldsCreation[noOfrows_,
noOfInputFields_] :=
(
Module[
{inputvaluelist = Table[0, {noOfrows}, {noOfInputFields}]},
(
If[
(noOfrows > 0),
(*If noOfrows value is greater than 0*)
(
{
Table[
(
With[{i = i, j = j}, (Row[{
Dynamic[InputField[
Dynamic[inputvaluelist[[i, j]]],
Number,
ContinuousAction -> True,
ImageSize -> {50, 20},
Alignment -> Center
]]
}])]
(*with is closed*)
),
{i, 1, noOfrows},
{j, 1, Length[Part[inputvaluelist, i]]}
],(*Table closed*)
Dynamic[inputvaluelist]
}
),
("")
]
)
]
(*Module closed*)
)
EndPackage[]
What I am looking at is to also be able to extract all the inputs that the user gives in the input fields into a list that we pass on to other functions. So that is a critical feature, which I am worried might also be a reason for the package giving trouble at cdf startup.