14

Test function: dateCheck[date_String] := StringMatchQ[date, DatePattern[{"Day", ":", "Month", ":", "Year"}]] Input field: InputField[Dynamic[date,If[TrueQ[dateCheck[#]], date = #, date = ""] &], String] This gives you a variable date that is a string of the form dd:mm:yyyy. If you want to convert it to a list or a number then e.g. DateList[{date, {...


14

Just like Albert I recommend using the second argument of Dynamic. Furthermore I recommend that you embrace the first A in AJAX, which stands for "asynchronous", so the kernel isn't busy while it collects the data (this might be why some change events are lost with your code). You can see how well the second argument of Dynamic works with this example: ...


11

I also took a crack at this. I think I made it look pretty close to the jquery example you posted. Figuring out how to move the insertion point to the end of the word once a suggestion is selected was a bit of a struggle. As a result, there's a DynamicWrapper in there that may be unstable. Input is the list of possible values from which you'd like to draw ...


11

My humble contribution: (* Use this function to style list elements *) listItemStyle[item_] := Mouseover[#, Style[#, Background -> LightBlue]] &@ MouseAppearance[Framed[item], "LinkHand"]; (* This filters the list of data and returns a clickable list *) SetAttributes[autoComplete, HoldFirst]; autoComplete[s_, data_] := If[ StringLength[s] > 0, ...


11

Perhaps something like this? text = ""; EventHandler[ InputField[Dynamic@text, String, ContinuousAction -> True], {"ReturnKeyDown" :> Paste["\n"]} ]


11

You can get custom colors and rounded corners by adding a custom frame to a frameless InputField. The following code approximates the look of Wolfram Alpha's input field: With[{opts = {FrameMargins -> 0, ImageMargins -> 0}}, Framed[ Framed[InputField[, ImageSize -> {500, 25}, Appearance -> "Frameless"], FrameStyle -> ...


10

Assign your input in DialogReturn, e.g. to a variable return. Apart from from this, and omitting your Dynamic@x at the end, your code is unchanged: DynamicForm[row_, col_] := DynamicModule[{x = ConstantArray[0, {row, col}], a}, a = {Column[(Row[#] & /@ Table[With[{i = i, j = j}, InputField[Dynamic[x[[i, j]]], Number, ...


10

I think the standard way to do this is to use the second argument of Dynamic, e.g. like so: With[{ getCompletion = Function[ Import[ "https://maps.googleapis.com/maps/api/geocode/json", "JSON", "RequestParameters" -> {"address" -> #} ] //. {{r__Rule} :> (Association[r])} ]}, DynamicModule[{ addr = "555 Mission St, San ...


9

If you want the evaluation to halt until the Dialog returns you can get your code working very simply: DynamicForm[row_, col_] := DialogInput[{x = ConstantArray[0, {row, col}], a}, Column[Flatten@{{Column[(Row[#] & /@ Table[With[{i = i, j = j}, InputField[Dynamic[x[[i, j]]], Number, FieldSize -> Tiny]], {i, 1, row}, {j, 1, ...


9

The simplest way is just data = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}}; InputField[Dynamic[data]] Dynamic[data] {{1, 2, 3, 4, 55}, {6, 7, 88, 9, 10}}


8

Here is one solution:- CreateWindow[DialogNotebook[{TextCell["Number of Stations: "], PopupMenu[Dynamic[ns, ( ns = #; (* set default values *) Function[n, (x[n] = 0)] /@ Range[ns]; col = Column[InputField[Dynamic[x[#]]] & /@ Range[ns]]) &], Range[2, 8]], TextCell["Sound Frequency (kHz): "], Dynamic[col], ...


8

Here is some code I have for entering a 8 digit id number. So this is "out of the box" as is. If you enter more than 8 digits the extra characters are immediately deleted. You can modify to suit your purpose: InputField[Dynamic[id, (id = Which[ StringMatchQ[#, DigitCharacter ..] && StringLength[#] >= 8,StringTake[#, 8], StringMatchQ[#,...


8

Response to edits: I don't know if I got all your points but this is the final update done by me :) v = {0.5, 0.05, 0.1, 0.15, 0.2}; active = Range@Length@v; update[i_, val_] := (v[[i]] = val; With[{range = DeleteCases[active, i]}, v[[range]] = (1 - val) Normalize[v[[range]], Total]]); updateCheckbox[i_, val_] := If[val, active = Join[active, {...


8

InputField[Dynamic[var], Boxes] Column[{InputField[Dynamic[var], Boxes], Dynamic[var], Dynamic[RawBoxes @ var], Dynamic[ToExpression @ var] }]


7

Note: This appears to really slowly in M9, although it works well in M8. It probably is better to use teedr's until it can be figured out what is causing the slow speeds. The following seems to work pretty well. I wrapped the options in a Pane and Framed so the entire row is clickable. ClearAll[AutoInputField]; SetAttributes[AutoInputField, ...


7

Maybe overkill but it was educational to try: DynamicModule[{}, EventHandler[ Overlay[{ Dynamic@Framed[ Row[{Style[x, Transparent, 15, Bold], Style[rest, GrayLevel@.6, 15, Bold]}], ImageSize -> {280, 30}, Alignment -> Top, FrameMargins -> {{5, 0}, {0, 1}}], InputField[Dynamic@x, String, BaseStyle -&...


7

Perhaps this slightly modified version of your code is closer to what you want. Remember, Ctrl+J, not Enter, to start a new line. DynamicModule[{data = "some\ndata"}, Column[{ Framed[ Pane[InputField[Dynamic@data, String, ContinuousAction -> True, Appearance -> None, FieldSize -> {Automatic, {1, Infinity}}], ...


7

Like Mike said in a comment, the key is to use the second argument of Dynamic. In this case I've built a function updateCurrencies which modifies a global variable currencies which holds an Association object with all the currency values in it. currencies = <| "USDollars" -> 0, "Euros" -> 0, "BritishPounds" -> 0, "SwedishKronor" ->...


6

If applying a new stylesheet doesn't change the appearance then it looks like the styling is local to each cell. If you have a look at the underlying expression of some of these input cells by going to the menu and choosing Cell > Show Expression you should see some StyleBoxes, as per this example using your code that you have supplied: So if it is the case ...


6

Perhaps, something like: inpF = DynamicSetting[Map[InputField[#, FieldSize -> 2, Alignment -> Center]&, #, {-1}]] &; Use it as (Ctrl+Shift+Enter to evaluate in place after highlighting the right hand side):


5

Edit: Now works with either Enter or Tab, thanks to ybeltukov. Now simplified with your own idea to use Null as the Dynamic variable: list = {}; Dynamic[list] Grid@{{InputField[Dynamic[Null, AppendTo[list, #] &]], Button["Reset", list = {}]}} Type expressions, then press Enter, and watch them appear in list (as viewed with Dynamic). Note that with ...


5

This dialog box version was put together some time ago for Mathematica 7 :- text = ""; DialogInput[{TextCell["Try to type a text with linebreaks :-)"], InputField[Dynamic[text], String, FieldSize -> {30, 6}], DefaultButton[DialogReturn[text]]}, NotebookEventActions -> {"ReturnKeyDown" :> FrontEndExecute[NotebookWrite[InputNotebook[], "\...


5

I'll show you hoe to do it for a 3 x 3 matrix of values. You should be able to extend to 3 x 12 without much trouble First do some initialization. headers = {"Jan", "Feb", "Mar"}; rowLbls = {" ", "Tmax", "Tmed", "Tmin"}; valTbl = ConstantArray[0, {3, 3}]; Next build the spreadsheet. MapThread[Prepend, { Prepend[ Array[InputField[Dynamic@...


5

Update. Thanks to Eldo, Dynamic is needed outside the InputField. DynamicModule[{a = 1, b = 20, fuc = "1"}, Deploy[Style[Panel[Grid[Transpose[ { {"Input Format", "Value"}, {PopupMenu[Dynamic[fuc], {"1", "2"}], Dynamic@InputField[ If[fuc == "1", a, b], Number, Enabled -> Dynamic[fuc == "1"] ...


5

Manipulate[ToExpression[func, TraditionalForm] /. x -> val, {{val, Pi, "x"}, InputField}, {{func, "", "f(x)"}, InputField[##, String] &}]


5

Better to use Table: n = Input["What positive integer would you like to start your matrix with?"]; Table[i + j*n, {j, 0, n - 1}, {i, n}]


5

Try wrapping the Option value in Dynamic: Panel[Column[{InputField[Dynamic[purchaseprice], Number, FieldHint -> "Purchase Price"], InputField[Dynamic[EK], Number, FieldHint -> "Equity capital"], InputField[Dynamic[mortgagerate], Number, FieldHint -> "Mortgage Rate in %"], InputField[Dynamic[supplymentary], Number, FieldHint -&...


5

If you work with Boxes you don't have to worry about evaluations: createExample[] := DynamicModule[{name=""}, Column[{ InputField[Dynamic[name],Boxes, ContinuousAction->True], Button[ "OK", Dynamic @ CellPrint[Cell[BoxData[RowBox[{name, "=", "99999"}]], "Input"]] ] }] ] A short animation:


5

Here's a different way to inject the value of name into the cell: createExample[] := DynamicModule[{name = Null}, Column[{ InputField[Dynamic[name], Hold[Expression]], Button["OK", name /. Hold[v_] :> CellPrint[ExpressionCell[Defer[v = 99999], "Input"]]] }] ] The reason var1 becomes 99999 in the OP's code is that the displayed ...


5

Here is what you can do: x = ToBoxes@Defer@Plot[x, {x, 0, 1}]; InputField[Dynamic[x], Boxes, BaseStyle -> {"Notebook", "Input", ShowCodeAssist -> True, ShowSyntaxStyles -> True} ] Dynamic@x Dynamic@MakeExpression[StripBoxes[x], StandardForm]


Only top voted, non community-wiki answers of a minimum length are eligible