Home Analyst Portal

Adding pre-defined text to a request offering textbox

Marc-Andre_LafleurMarc-Andre_Lafleur Customer Adept IT Monkey ✭✭

Hi,

I'm trying to add pre-defined text to a Request Offering text area. Adding the text works well but when we submit the form, the portal act like there is nothing in the textbox.

For optional fields, it saves the form without saving the pre-defined text and for required we can’t submit without doing manual changes to the text area.

Here's how I add the text:

if (location.pathname == "/SC/ServiceCatalog/RequestOffering/4dea0ebf-e13c-b64a-6ea3-90a6fa94b004,87f7b7c5-7799-51ee-c8eb-91a08ec392a8")
{
    (document.getElementById("textArea8d7e3e96-5ca5-46f1-8096-b5903a2e3e2e")).value = 'This is pre-defined text';
};

It seems to be because of the way the save button get the values but any method I'm using gets the same result.

Did anyone managed to achieves something similar or know how I could get the Request Offering form to save my pre-defined text?

Thanks!

Best Answer

  • joivan_hedrickjoivan_hedrick Cireson Consultant Advanced IT Monkey ✭✭✭
    edited June 2016 Answer ✓
    Ahh, a required field. We'll have to cheat for these types of fields, and make it think that we actually edited the field as a human, instead of programmatically. This allows us to trigger the required verification. 
    <br><div>$("#textArea7027fd5b-13c3-486a-b8e1-a2bbc58f2289").val("This is pre-defined text!");
    $("#textArea7027fd5b-13c3-486a-b8e1-a2bbc58f2289").keyup()
    </div>

    This works for me using v5.0.6 of the Portal.

Answers

  • joivan_hedrickjoivan_hedrick Cireson Consultant Advanced IT Monkey ✭✭✭
    This should work if you change your code to something like: 
    $("#textArea7027fd5b-13c3-486a-b8e1-a2bbc58f2289").val("This is pre-defined text!");


  • Marc-Andre_LafleurMarc-Andre_Lafleur Customer Adept IT Monkey ✭✭

    It actually does the same result:

    Were you able to submit successfully using this? It doesn't work for me on 5.5

  • joivan_hedrickjoivan_hedrick Cireson Consultant Advanced IT Monkey ✭✭✭
    edited June 2016 Answer ✓
    Ahh, a required field. We'll have to cheat for these types of fields, and make it think that we actually edited the field as a human, instead of programmatically. This allows us to trigger the required verification. 
    <br><div>$("#textArea7027fd5b-13c3-486a-b8e1-a2bbc58f2289").val("This is pre-defined text!");
    $("#textArea7027fd5b-13c3-486a-b8e1-a2bbc58f2289").keyup()
    </div>

    This works for me using v5.0.6 of the Portal.
  • Marc-Andre_LafleurMarc-Andre_Lafleur Customer Adept IT Monkey ✭✭

    That works, thank you!

This discussion has been closed.