Jump to content

Separate Input Fields for Height Parts


Recommended Posts

Hi there,

I decided to share a script that will help to have 2 separated virtual fields to display foots and inches separated. Similar to Date/Time Parts https://howto.caspio.com/tech-tips-and-articles/common-customizations/separate-input-fields-for-datetime-parts

<script>
document.addEventListener('BeforeFormSubmit', function(event) {
	let ft = document.querySelector("#cbParamVirtual1").value;
  let inch = document.querySelector("#cbParamVirtual2").value;
  document.querySelector("#InsertRecordHeight").value = `${ft}′ ${inch}″`
});
</script>

The result that we get will look like 1′ 2″. It can easily be chanded to whatever you need.
For example if we change `${ft}′ ${inch}″` to `${ft}ft ${inch}in`, the result will be 1ft 2in.

 

Hope it helps someone.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...