Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Text field in dynamic stamp

New Here ,
Jul 30, 2021 Jul 30, 2021

Capture 1.JPG

 

Hello people

 

I have read through countless postes and am unable to figure out how to get this stamp to work 

 

text 1 workes perfectly as a automatic date 

 

i need text 2 to be just a regular text feild so when i wherever on the screen i can then add a 6 digit number ex 416051 not more not less 

 

Much aprechiated 

TOPICS
JavaScript , PDF forms
3.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 30, 2021 Jul 30, 2021

Stamps don't work like that. Once you apply them all the fields in them become flattened. You have to prompt the user to enter the value for this field when the stamp is applied, and then populate it into the field. After the stamp is applied it can't be edited any longer. You can only delete the stamp and re-apply it using a new value.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 31, 2023 Aug 31, 2023

Hello try

You seem like a expert so i would love to ask for your help with a dynamic stamp problem of mine. 
I have a dynamic stamp with many fields which are filled by: value = app.response(""). in some cases i don't need the script to ask for all the fields so it would be nice that whit some kind of input in the app.response-pop-up i could end the script prematurely. I hope you understand my problem. English and Coding are not my native languages..haha
Thanks in advance

Timo

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 31, 2023 Aug 31, 2023
LATEST

If you want to include logic in determining which values to prompt the user to enter using a dialog object might be a better idea. This is not a trivial scripting task, though.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 31, 2021 Jul 31, 2021

To be placed in calculation script of the Text2 field:

var answer="";
while (!/^\d{6}$/.test(answer) && answer!=null) {
	var answer=app.response({
		cQuestion: "Enter a 6-digit number.",
		cTitle: "Reference",
		cLabel: "MAXIMO #",
		});
}
if (answer!=null) event.value=answer;
else event.value="";

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 31, 2021 Jul 31, 2021

If you do that it will prompt you to enter the value even when you just preview the stamp in the stamps list...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 01, 2021 Aug 01, 2021

I understand what try67 is meaning, so write:

 

if(event.source.forReal && event.source.stampName=="#Received") {
	var answer="";
	while (!/^\d{6}$/.test(answer) && answer!=null) {
		var answer=app.response({
			cQuestion: "Enter a 6-digit number.",
			cTitle: "Reference",
			cLabel: "MAXIMO #",
			});
	}
	if (answer!=null) event.value=answer;
	else event.value="";
}

 

...and in the script, change the stamp name "#Received" by the one indicated in the template of your stamp.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 30, 2023 Jun 30, 2023

What if you don't want to limit it to six characters, and want to allow letters as well as numbers?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 30, 2023 Jun 30, 2023

Then don't use the conditional code at all. Just this:

if(event.source.forReal && event.source.stampName=="#Received") {
	event.value=app.response("Enter the value for this field:");
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2023 Jul 01, 2023

Hi,

Me I suggest this script to avoid the stamp from displaying "null":

 

if(event.source.forReal && event.source.stampName=="#Received") {
	var answer=app.response({
		cQuestion: "Enter a reference.",
		cTitle: "Reference",
		cLabel: "MAXIMO #",
	});
	if (answer!=null) event.value=answer;
	else event.value="";
}

 

 @+

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines