3

My doubt is : I have custom vf page for account object . I have few disabled fields in that page whose values will be populated based on autocomplete field selection using jquery autocomplete widget. I have few other mandatory fields after the disabled fields.

Test scenario :

  1. I will select one value from autocomplete field which will populate the disabled fields.
  2. I will not fill the mandatory fields . On click of save error for mandatory fields is thrown but it is clearing the disabled field values. Eventhough i am using some hidden fields to store the values of disabled fields it doesnt help.

Any solution how to keep the values intact in disabled fields will be of great help. Let me know if i am not clear ,i can explain the doubt if required.

  • Are you use an inputField? – Sergej Utko Oct 9 '13 at 11:16
  • nopes i am using inputText for disabled fields. – Sf Dev Oct 9 '13 at 11:29
1

If your inputs are anyway hidden you can use just a normal html fields to output/show the selected values and use hidden fields to assign values to use in controller.

<script>
    function someFunction(){
        jQuery('[id$=myVar1Hidden], #myVar1Output').val(value1);
    }
</script>

<!-- This will be used to pass the variable to the controller -->
<apex:inputHidden value="{!myVar1}" id="myVar1Hidden" />

<!-- This is only to show the selected value to the user on the page -->
<input type="text" id="myVar1Output" value="" disabled="disabled" />
  • using apex:inputText and normal text to display is the same. – Sf Dev Oct 9 '13 at 11:40
  • I figured it out myself . When i checked the page source the hidden values corresponding to disabled fields were having the values while disabled values were not . I populated to hidden values into disabled fields on page load and hence its showing now. Thanks for all the inputs which helped me get to the desired solution. – Sf Dev Oct 9 '13 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.