@@ -391,6 +391,20 @@ commonly used. You can also use the normal modifiers, like
391
391
``data-model="on(change)|*" `` to, for example, only send
392
392
model updates for the ``change `` event of each field inside.
393
393
394
+ Model Updates don't work when External JavaScript Changes a Field
395
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
396
+
397
+ Suppose you use a JavaScript library that sets the value of a field
398
+ *for * you: for example a "date picker" library that hides
399
+ the native ``<input data-model="publishAt"> `` field and sets it
400
+ behind-the-scenes when the user selects a date.
401
+
402
+ In this case, the model (e.g. ``publishAt ``) will probably *not *
403
+ update correctly because JavaScript doesn't trigger the normal
404
+ ``change `` event. To fix this, you'll need to "hook" into the
405
+ JavaScript library and set the model directly (or trigger a
406
+ ``change `` event on the ``data-model `` field). See :ref: `working-in-javascript `.
407
+
394
408
LiveProp for Entities & More Complex Data
395
409
-----------------------------------------
396
410
@@ -527,6 +541,8 @@ live property on your component to the value ``edit``. The
527
541
``data-action="live#update" `` is Stimulus code that triggers
528
542
the update.
529
543
544
+ .. _working-in-javascript :
545
+
530
546
Working with the Component in JavaScript
531
547
----------------------------------------
532
548
0 commit comments