Home Analyst Portal

Auto-hide a field

Brian_WinterBrian_Winter Customer Advanced IT Monkey ✭✭✭

I've added several custom fields to the SR form Checkbox A, B, and C as well as Textareas AA, BB, and CC.

The customer wants AA to be visible only when A is checked and so for BB and CC.

I've tried a solution with JSON as well as JavaScript and have run into no luck. I was able to accomplish this with a Save or Apply, but they want it OnClick.


Then, just to add to the difficulty, this is ONLY applicable if there is a keyword in the Title, but I can't even examine the value of the title!

Help, please.

Best Answer

  • Jeff_LangJeff_Lang Customer Ninja IT Monkey ✭✭✭✭
    Answer ✓

    @Brian_Winter

    We do this with a lot of fields on change requests to completely change the forms as required. I've edited our change request one and made up one quick that should work for service requests as you described up above. I left in the code to make the text area's required or not, but only set the AA as required when visible, the others don't get this set, i also left in the code that can make inputs and dropdowns required or not. have not tested so may be the odd typo or coding mistake, but should be enough to get you going :) also you might need to double check the "$('label[for=CC]')" I took a guess as to what they would be called, adjust as needed



Answers

  • Jeff_LangJeff_Lang Customer Ninja IT Monkey ✭✭✭✭
    Answer ✓

    @Brian_Winter

    We do this with a lot of fields on change requests to completely change the forms as required. I've edited our change request one and made up one quick that should work for service requests as you described up above. I left in the code to make the text area's required or not, but only set the AA as required when visible, the others don't get this set, i also left in the code that can make inputs and dropdowns required or not. have not tested so may be the odd typo or coding mistake, but should be enough to get you going :) also you might need to double check the "$('label[for=CC]')" I took a guess as to what they would be called, adjust as needed



  • Brian_WinterBrian_Winter Customer Advanced IT Monkey ✭✭✭

    Hi @Jeff_Lang ,

    I finally got a chance to test this code and it works like a charm. Seven checkboxes make seven textareas appear and disappear like Houdini!

    My problem was trying to access the field control name directly instead of going after the label.

    Thanks for the Solution!

Sign In or Register to comment.