I am trying to generate a table of InputFields with a list of variables. I am generating the variable names on the fly as the lists I am dealing with have variable sizes.
len := 10
pv := Table[ToExpression["pv" <> ToString[n]], {n, len}]
ab := Table[
With[{n = n},
InputField[Dynamic[pv[[n]]], FieldHint -> "Value",
FieldSize -> 5]], {n, len}]
This generates the table of input fields that I want. However, there are two issues:
- When I try to change value of pv[[1]], (for example), directly rather than through the input field, I get an error: Set: Symbol pv in part assignment does not have an immediate value. I can chanage pv1 directly but not via the list index. I would like to be able to do this via the list index as I am handling big lists with variable number of columns and rows.
- When the input field is generated it has the variable name in it. I have tried to override it with FieldHint. However that doesn't work. I still get the variable name in the input field. I would like to have an empty input field displayed.
I have read the Dynamic and Control documentation, searched the web multiple times, etc. There is something basic that I am not understanding on the use of Dynamic here. Any help would be greatly appreciated. Thanks
pv
later or accesspv1
directly? In many cases using a List or Association forpv
would be good enough and more handy. $\endgroup$PV = <||>; InputField[Dynamic[PV[#]], Number, FieldHint -> "Value", FieldSize -> 5] & /@ Range[5]
it may introdce issues for large sets of values but should be fine for daily usage. $\endgroup$