setFieldValue

brixxApi function to set a value to a field

Parameters

  1. controlId => Id of the control

  2. value => The value, you want to set. This could be a number, a date, a string (depending on the control type of course). setFieldValue will do all the conversions for you.

Example Usages

1. Simple textbox

   brixxApi.setFieldValue("myControlId", "Hello World!");

2. With a variable

   let myText = "Hello World!";
   brixxApi.setFieldValue("myControlId", myText);

3. Setting a date

   brixxApi.setFieldValue("myDateControl", "2019-01-31"); //This is the format, you would get by getFieldValue
   brixxApi.setFieldValue("myDateControl", new Date()); //This will set todays date.
   brixxApi.setFieldValue("myDateControl", new moment().add(1, "month")); // you can use moment to set calculated dates. See https://momentjs.com/ for more details and examples

4. Setting a date to a calendar control scrolls to that date.

   brixxApi.setFieldValue("myCalendarControl", "2019-01-31");

5. The Calendar supports subcontrols to set. You can add resource(s) to the calendar for example:

   //resources will delete all and set a new array of resources
   brixxApi.setFieldValue("myCalendarControl.resources", [ 
   {
       id: 1,
       title: "Room A",
   },
   {
       id: 1,
       title: "Room B",
   }]);

   //resource will add a single resource
   brixxApi.setFieldValue("myCalendarControl.resource", { 
       id: 1,
       title: "Room A",
   });

Demo

Last updated