Linking calculator results to an external input field
Follow the instructions below to set your calculator up to send its results to external input fields of the same page it is embedded to:
- Login to your Calconic account.
- Click My Calculators and select the calculator you are building.
- Click the Gear icon on the left side.
- Click Advanced Settings.
- Click the Load Example button.
- Select External Output Example.
- Modify the code snippet according to your needs.
- Click Save.
- Embed the calculator to your website (Standard or Lightbox mode only). Make sure that the embedded calculator is on the same page as the input field.
Attributes of the code snippet
<input type="number" name="change" />
In this case, your SELECTOR attribute should look like the following:
Accordingly, you can change some specific text of your website. It has to be surrounded by <div> or <p> tags and named. For example:
<div name="changeit">text that will be changed</div>
Then your SELECTOR attribute would look like the following:
REF - the reference to the calculator's element you are trying to take the value from.
METHOD - We provide 3 different methods to embed the calculator value:
- ATTRIBUTE - Will set the value into a specified HTML attribute of the selector
- APPEND - Will append the value into the selected element without removing the content inside the selected HTML element
- InnerHTML - Will replace the contents of the selected HTML element completely with the value
ATTRIBUTENAME - in case you have specified the embed method as ‘attribute’, use this field to specify which attribute of the HTML element would you like to have the value embedded to. This field will be ignored if any method other than Attribute is used within the settings.
Each time the specified element value is changed, its value will be sent to the specified selector using the method you specified.
This can be used to change the value of any input or text on your website.