How to pass value to a form field from Javascript

I have an onClick event which opens up a form in a modal. I want to pre-set some of the values in that form from the onClick event. I’ve tried this…

dmx.parse('fullCalModal_add.frm_add_tripbit.inp_title.value("' + title + '")');

whith throws an error
parser.js:752 Formatter value doesn’t exist for type object
(anonymous) @ parser.js:752
(anonymous) @ parser.js:708
(anonymous) @ parser.js:449
dmx.parse @ parser.js:382
select @ c.php:45
t.publiclyTrigger @ fullcalendar.min.js:10
e.publiclyTrigger @ fullcalendar.min.js:9
e.triggerSelect @ fullcalendar.min.js:7
e.reportSelection @ fullcalendar.min.js:7
interactionEnd @ fullcalendar.min.js:10
t.trigger @ fullcalendar.min.js:8
t.handleInteractionEnd @ fullcalendar.min.js:8
e.handleInteractionEnd @ fullcalendar.min.js:6
t.endInteraction @ fullcalendar.min.js:8
i @ jquery-3.3.1.slim.min.js:2
e @ fullcalendar.min.js:6
dispatch @ jquery-3.3.1.slim.min.js:2
v.handle @ jquery-3.3.1.slim.min.js:2
trigger @ jquery-3.3.1.slim.min.js:2
triggerHandler @ jquery-3.3.1.slim.min.js:2
e.trigger @ fullcalendar.min.js:6
t.handleMouseUp @ fullcalendar.min.js:6
i @ jquery-3.3.1.slim.min.js:2
dispatch @ jquery-3.3.1.slim.min.js:2
v.handle @ jquery-3.3.1.slim.min.js:2
[Deprecation] ‘-webkit-appearance: listbox’ for elements other than listbox select is deprecated and will be removed in M79, around December 2019. See https://www.chromestatus.com/features/5070237827334144 for more details.

and

dmx.parse('fullCalModal_add.frm_add_tripbit.inp_title.value = "' + title + '"');

which throws an error “parser.js:384 Error: Lexer Error: Unexpected token ‘=’ at column 49 in expression [fullCalModal_add.frm_add_tripbit.inp_title.value = “adfdaf”]”

To select a record and load it into an update form like this does work…

dmx.parse('fullCalModal.data_detail1.select("' + id + '")');

I’m assuming it’s just a syntax error but not sure what else to try.

Thanks,
Heather

Community Page
Last updated: