โ04-27-2023 01:48 AM
Hi,
I am building a custom snap where some of the fields need to be a โtextareaโ type. Iโve been searching through the documentation but didnโt find anything related to this.
Is there a way to make the field a text area ?
I am looking for something like the private/public keys in the account of a PGP Encrypt snap where the inputs are text area types.
On the image below, the input types are different from the โKey pasphraseโ which is of an โinputโ type but the private and public keys are of โtext areaโ type.
@ptaylor Any suggestions please ?
โ04-27-2023 09:39 AM
Yes: call .uiRowCount(int)
when building the property.
โ04-28-2023 02:12 AM
Thank you, that works, however I am unable to properly parse the value from the field ?
Does it return a string or something else ?
Hereโs what I have:
...
private static final String PRIVATE_KEY = "Private key";
private static final String PUBLIC_KEY = "Public key";
...
private String privateKey; // This is used to capture the value from the private key property
private String publicKey; // This is used to capture the value from the public key property
Then the defineProperties method:
...
propertyBuilder.describe(PRIVATE_KEY, "Private key")
.required()
.uiRowCount(10)
.add();
propertyBuilder.describe(PUBLIC_KEY, "Public key")
.uiRowCount(10)
.add();
...
Then the configure method:
@Override
public void configure(PropertyValues propertyValues) {
...
privateKey = propertyValues.get(PRIVATE_KEY);
publicKey = propertyValues.get(PUBLIC_KEY);
...
}
This is how the snap looks like with the properties:
However, when the pipeline is executed with the snap included, it returns the following error:
Snap has the following errors.
Please open the info box and edit the highlighted fields.
* Failure: Private key: asdasd is undefined.
Perhaps you meant: task, Base64, parseFloat, parseInt,
Reason: Snap failed unexpectedly and did not provide any reason,
Resolution: Check the spelling of the variable
Is it because .uiRowCount(int) returns a different type than String, so it is not able to parse it correctly in the configure() method ?
โ04-28-2023 07:11 AM
Please open the Pipeline Statistics, expand the details, copy the stack trace and paste it here.
โ04-28-2023 11:09 AM
do share the full body of the configure() method.