parse rrn from id

About This Space

Empty template with the basics set up for a quick display.


Last updated on June 21, 2021

Forked from: /megan_bond/parse-rrn-from-id/

Public Permissions:   View   Open/Fork   Run   Comment  

Quick Display

Description

Explanations

The browser's limitations are often for good reason, though not everyone agrees with their reasoning. One limitation that is currently frustrating many developers is the lack of a standard JavaScript method to get from and copy to the user's clipboard. There is a weakly supported method for it now, but the problem is that it's not a universal standard, and it's not even a standard for the browsers that support it. It's in a kind-of beta phase and may change drastically in the future. This is upsetting for developer's who'd rather not have to go back and redesign code they've already written because of a breaking change to some of the API's they used.

That being said, using the combo box is almost the same, just needs a few adjustments. I have updated the workspace to include combo box column so you can check out the code in action. I would suggest using the code provided below instead of checking the event code on the workspace for now because I was investigating some potential issues I ran into while creating the combo box example and now the code is a bit of a mess in the workspace.

// Because the combo box is a div with a textbox inside of it, either element
// could really be the passed object, but our API has it set up to pass the input object
// instead of the combo box widget object as `this`, except for the onselect event, which 
// can still use `this.id`. The div element has the widget's id, so we need to reference
// in this example because I'm using the onclick event. (onchange does not currently work
// with combo boxes, as far as I can tell.)
var selectboxID = this.parentElement.id;
var selectboxValue = get(selectboxID);
 
// Still need to get the index of the period. 
var dotIndex = selectboxID.lastIndexOf('.');
 
// Still need to get the row number.
var rrnRowNum = selectboxID.substring(dotIndex+1);
 
// Still need to generate the textbox's id.
var textboxID = 'TextBox2' + '.' + rrnRowNum;
 
// The onclick event of the combo box is passed the rowNumber variable, the onselect event
// does not currently get the rowNumber variable.
pui.set(textboxID, 'You clicked the select box in row ' + rrnRowNum + '! ...No, wait... Row ' + rowNumber + '.' );
 
// Getting the value of the combo box widget is as easy as using `this.value` as done preivously,
// but you'll notice here that I put `this.value` twice, this is because there is no text value
// retained by the combo box to access, currently. So, for this one, you'd want the value to be
// what you want to get. The options can be whatever else you'd like. 
pui.set(textboxID, 'You selected option "' + this.value + '" with value "' + this.value);

How to Use

Fork to new workspace to use.


App...                                ...Name
File index.js
Function index() {...}
Display index.json
Screen index

Author: megan.bond

Date: June 11th, 2019

Be the first to comment:      

Comments

Write Preview Markdown: bold italic code link
Post

Filters:

Popular Recent

Testing the onchange event in various ways.

3371

0

0

Testing the onchange event in various ways.

3351

0

0