4 Replies Latest reply on Apr 3, 2009 6:22 AM by nbelaevski

    How to pass the value from javascript to richfaces

    aboocs01

      hi,

      here im using this script......


      dojo.require("dojox.widget.ColorPicker");
      var handler = function(val,id){
      alert("id is "+id)
      dojo.byId(id).value = val;
      alert("val"+dojo.byId(id).value)
      id='colours'+id;

      };



      this above script is to get the colour code from dojo component.....
      this above script is perfect....


      now i am using this rich component:

      <div id="picker" dojoType="dojox.widget.ColorPicker" value="#ffffff" onChange="handler(arguments[0],'1')">


      <rich:inplaceInput id="clrval" value="#{customizeManager.providerParamsMap.CALENDAR_COLOR_1}" maxLength="6" defaultLabel="click to enter colour code" minInputWidth="65">
      <a:support event="onchange" oncomplete="change_box_color(1);"/>
      </rich:inplaceInput>

      here i want to display what colour i select from javascript... that should the colour in the rich:inplaceInput component.... how can acheive this...


        • 1. Re: How to pass the value from javascript to richfaces
          aboocs01

          sorry:

          hi,

          here im using this script......

          dojo.require("dojox.widget.ColorPicker");
          var handler = function(val,id){
          alert("id is "+id)
          dojo.byId(id).value = val;
          alert("val"+dojo.byId(id).value)


          };





          this above script is to get the colour code from dojo component.....
          this above script is perfect....


          now i am using this rich component:

          <div id="picker" dojoType="dojox.widget.ColorPicker" value="#ffffff" onChange="handler(arguments[0],'1')">


          <rich:inplaceInput id="clrval" value="#{customizeManager.providerParamsMap.CALENDAR_COLOR_1}" maxLength="6" defaultLabel="click to enter colour code" minInputWidth="65">
          <a:support event="onchange" oncomplete="change_box_color(1);"/>
          </rich:inplaceInput>

          here i want to display what colour i select from javascript... that should the colour in the rich:inplaceInput component.... how can acheive this...

          • 2. Re: How to pass the value from javascript to richfaces
            ilya_shaikovsky

            1) use code tags to paste the code.
            2) RF already provides colorpicker in 3.3.1 beta2
            3) read inplace docs carefully. onchange - seems not and attribute that you need.
            4) read about data attribute of ajax component which allow to pass data from server side to js handlers.

            • 3. Re: How to pass the value from javascript to richfaces
              aboocs01

               

               <script type="text/javascript">
               dojo.require("dojox.widget.ColorPicker");
               var handler = function(val,id){
               alert("id is "+id)
               dojo.byId(id).innerHTML = val;
               alert("val"+dojo.byId(id).value)
              
              
               };
              
               </script>
              
              this above script is to get the colour code from dojo component.....
              this above script is perfect....
              
              
              now i am using this rich component:
              
              <div id="picker" dojoType="dojox.widget.ColorPicker" value="#ffffff" onChange="handler(arguments[0],'1')"> </div>
              
              <div id="1"> hexavalue: </div>
              
              <rich:inplaceInput id="clrval" value="#{customizeManager.providerParamsMap.CALENDAR_COLOR_1}" maxLength="6" defaultLabel="click to enter colour code" minInputWidth="65">
              </rich:inplaceInput>
              
              yes i know there is richfaces colour picker, but let me try for this.....
              
              let me explain what is happening exactly:
              
              from the above javascript i will use dojo tool kid for colour picker and what ever colour im selecting in the dojo colour picker i can able to render in the jsp page.... upto this is happening perfectly...
              
              
              now come to the richface .... you see the code for rich:inplaceInput ... in this component i want to display the colour value which i selected in the dojo colour picker...
              
              note * ilya_shaikovsky really thank u for quick reply and your helping me lot by answering... but i am very new to this... so can you explain me much more in details... so that i can learn quickly... please....


              • 4. Re: How to pass the value from javascript to richfaces
                nbelaevski

                Hello,

                Use setValue() method of component JS API.