How to load form once combobox value is selected?

2 posts, 0 answers
  1. Adam
    Adam avatar
    5 posts
    Member since:
    May 2019

    Posted 24 Jun Link to this post

    Hi,

    I have the following code:

    <script>
    Sys.Application.add_load(FormLoad) 
     
     function FormLoad()
     
      {
     
        HideOpportunity(true);
      
       
     
        function HideOpportunity(sender, eventArgs) {
      var x = document.getElementById("OpportunitySetUp");
       if (x.style.display === "none") {
        x.style.display = "block";
      } else {
        x.style.display =  "none";
      }
           
        var ForecastingGrid = document.getElementById("ForecastingRevenue");
       
         ForecastingGrid.style.display = "none";
     
         
        var RevenueForecasting  = $sq("[id$='cboRevenueForecasting']").val();
         
         if (RevenueForecasting == "Manual Phasing") {
            ForecastingGrid.style.display = "block";
        } else {
            ForecastingGrid.style.display = "none";
        }
         
      }
      </script>

     

    This seems to work perfectly up until the combobox value is selected. The code only seems to execture and show the "ForcastingRevenue" section when "autopostback = true" is added to the combobox properties but this is useless as it refreshes the page of the form, resetting the other .style.display element of "OpportunitySetUp".

    Is there a way to have the form load without adding in the autopostback property? I'm using the Cora Sequence framework if that is any use. 

     

    Thanks for any help!

  2. Rumen
    Admin
    Rumen avatar
    14010 posts

    Posted 27 Jun Link to this post

    Hi Adam,

    Have you tried to cancel the postback:

    Cancelling an Event
    Several client-side events occur immediately before RadComboBox performs some action. Most of these events all have names that end with "-ing". You can use these events to cancel the RadComboBox's action by using the set_cancel method of the eventArgs passed to the handler:

    JavaScript

    function OnClientSelectedIndexChanging(sender, eventArgs) {
        eventArgs.set_cancel(true);
    }

    Another approach is to show the ForcastingRevenue for example in the OnClientSelectedIndexChanging event of the combobox.

    If you need further assistance on this, please provide a sample reproduction page or its contents so that I can replicate the scenario and can work on it on my side.

    Regards,
    Rumen
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top