How to make read only field that retrieve value from AJAX script

Dear, All

https://community.sagecrm.com/partner_community/b/hints_tips_and_tricks/archive/2009/04/21/using-ajax-to-accessing-server-side-objects-client-side.aspx

From above link related with ajax code I have some question. How to make read only field that retrieve value from AJAX script ?

When I change field to read only like a Brand, system will display scrip error popup such as below picture

Best Regards,

Aum

  • 0

    Hi Aum

    When the field is read only, we can read from the "_HIDDEN" + field name to get the existing values.

    So we can try the following

    if (document.getElementById('oppo_extraperson') != null) {

    persid = document.getElementById('oppo_extraperson').value;

    }

    else {

    persid = document.getElementById('_HIDDENoppo_extraperson').value;

    }

    Hope this helps.

    Kristi Feng

  • 0

    Hi Kristi

    Thank you for your suggestion, but I try to use above codes it's not work. May be I type this code in wrong possition, if it position please give me more details for above code

    Thank you

    Aum

  • 0

    Hi Aum,

    I assumed that you already have some code under the custom content of your screen definition.

    You probably have something for

    document.getElementById('oppo_extraperson').value

    You need to first do a condition check to see if you can retrieve the value with document.getElementById('oppo_extraperson') != null

    If you can then continue with your existing code, if not get the new value from document.getElementById('_HIDDENoppo_extraperson').value

    Hope this helps.