Fusion Manage Forum
Welcome to Autodesk’s Fusion Manage (formerly Fusion 360 Manage) Forum. Share your knowledge, ask questions, and explore popular Fusion Manage topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to validate length of a Single Line Text field and warn if value is too long

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
jdow
637 Views, 5 Replies

How to validate length of a Single Line Text field and warn if value is too long

Hi,

I have a situation in which i'm trying to trap the length of a field and depending upon the value in another field compare the length and if > then 30 push a message to the user that this field must be reduced.  Is this even possible?

 

I'm in the Items & BOMs WS.

I have a field called Description.

A field called Location.

If the location field is value 1 then Description field must be 30 chars or less.

If location field is value 2 then Description field must be 60 chars or less.

If location field is value 3 then Description field must be 90 chars or less.

 

What I'd like to be able to do is to validate the description field upon saving that record (from an edit) and have the script run (Behaviors - Script to run when item details are modified) and check these two fields using the logic outlined.  If it fails then I'd like to push out a message to the user indicating such.

 

Now, i have written the script, but it will not push or return a message in this manner.  I will work if i was to add a workflow and do this upon workflow transition.  Again, can you push or return a message window back the user from the Item Details tab view?

 

Thank you,

John

JD
5 REPLIES 5
Message 2 of 6
nguyentru
in reply to: jdow

Hi John,

 

Currently our Action Script doesn't push a message(s).  

 

You have two options:

 

Option 1 use the Computed Field to generate your message when the user save or edit a record.

You will need to create an Output Display Field to generate and display the message based on the other input fields.

Case

WHEN (VALUE_1 =1) THEN '30 CHARACTERS'

WHEN (VLAUE_2 =2) THEN '60 CHARACTERS'

ELSE

'REQUIRE INPUT'

END

COMPUTED FIELD.PNG

 

Option 2 - Utilize the Validation Script and trigger through the worfklow.  The Validation Script will push out the error message in the Workflow Comments.  I will also prevent the use to move to next phase in the workflow.

 

var messages = [];

 

if(itemVALUE_1 === '1'){

    messages.push('30 Characters')

}

 

returnValue(messages);

 

Capture.PNG

 

I hope these two options will help you in achieving your needs and objectives.

 

thank you,

 

Trung

Trung Nguyen | PLM Product Management | Autodesk, Inc.
Message 3 of 6
gasevsm
in reply to: jdow

As admin can set display width of field, but also length which will drive max length - as user types, it would stop at that max length value.

Also can add maxlength and minlength validations to the field. This way user creating or rooting item will be interrupted if goes out of bounds on a Save.

HTH,

Martin Gasevski | Fusion 360 Team Product Manager
Message 4 of 6
jdow
in reply to: nguyentru

Thank you Trung,

 

Your first option will get me closest to what i'm trying to accomplish.

I ended up creating an Action script to test the 2 values with the result passed back as 'pass' or 'fail' to another field that i'll hide in its own section.

I then created a display output field that uses a computed value to display the warning message that i want and was also able to format it with bold red text.

 

John

 

 

 

JD
Message 5 of 6
jdow
in reply to: gasevsm

Yeah, I understand that. I probably neglected to state this one field has 2 possible max char lengths depending upon the values of a second field. We didn't want to create two different description fields (one for one location and one for another location) as that wouldn't be easy to do searches against, scripting, reports, etc.
JD
Message 6 of 6
gasevsm
in reply to: jdow

Ah I see. Trung's approaches would work in this case. Cheers,

Martin Gasevski | Fusion 360 Team Product Manager

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report