12 Replies Latest reply on Apr 25, 2014 10:38 AM by Saroj Sahu

    Is it possible to trigger "Enter" (same as keyboard Enter) through Activelink?

      Share:|

      can anyone let me know

      if we are able to trigger "Enter" (same as keyboard Enter) through Activelink?

      Usecase is : On HPD:Help desk form , we have a field and submit button

      when a user provide a value in that field and click on submit button, it should throw error message if no value provided.

      Eventhough value is provided, it is giving error ( workflow is proper), but if we provide value & click on enter from keyboard on the same field, it is recognizing the value & validation works as expected. So now we need to trigger an action through Activelink that should be same as click on Enter from keyboard.

      Please help me here.

       

      Thanks in advance.

        • 1. Re: Is it possible to trigger "Enter" (same as keyboard Enter) through Activelink?
          Fred Grooms

          You can add an Active Link that fires on Lose Focus of the field (Probably put in the Run-If  if the field is not null).  In the Actions do a RunProcess action. This will fire all workflow that would have fired if the user had pressed Enter.

           

           

          PERFORM-ACTION-ACTIVE-LINK

          Executes all active links associated with the specified Execute On condition (and field ID, as needed). The active links fire as if the Execute On condition indicated occurred. For example, PERFORM-ACTION-ACTIVE-LINK 8 specifies to run all On Modify active links as if a modify operation was performed. The active links fire, but no modify is actually performed.

           

          Row Double Click or Return: PERFORM-ACTION-ACTIVE-LINK 2 fieldID

          • 2. Re: Is it possible to trigger "Enter" (same as keyboard Enter) through Activelink?
            LJ LongWing

            Satya,

            I believe what you are looking for is this run-process command.  This Run-Process can tell workflow that fires on one condition to cause another piece of workflow to fire on a different condition....so you can have the button press execute this run-processs and have it execute the workflow that fires on Return on the other field.

             

            Command: PERFORM-ACTION-ACTIVE-LINK

            Executes all active links associated with the specified Execute On condition (and field ID, as appropriate). The active links fire as if the Execute On condition indicated occurred. For example, PERFORM-ACTION-ACTIVE-LINK 8 specifies to run all On Modify active links as if a modify operation was performed. The active links fire, but no modify is actually performed.

            The options for this command are as follows:

            • Button: PERFORM-ACTION-ACTIVE-LINK 1 < field_ID>
            • Return/Table Dbl-Clk: PERFORM-ACTION-ACTIVE-LINK 2 < field_ID>
            • Submit: PERFORM-ACTION-ACTIVE-LINK 4
            • Modify: PERFORM-ACTION-ACTIVE-LINK 8
            • Display: PERFORM-ACTION-ACTIVE-LINK 16
            • Menu Choice: PERFORM-ACTION-ACTIVE-LINK 128 < field_ID>
            • Lose Focus: PERFORM-ACTION-ACTIVE-LINK 256 < field_ID>
            • Set Default: PERFORM-ACTION-ACTIVE-LINK 512
            • Search: PERFORM-ACTION-ACTIVE-LINK 1024
            • After Modify: PERFORM-ACTION-ACTIVE-LINK 2048
            • After Submit: PERFORM-ACTION-ACTIVE-LINK 4096
            • Gain Focus: PERFORM-ACTION-ACTIVE-LINK 8192 < field_ID>
            • Window Open: PERFORM-ACTION-ACTIVE-LINK 16384
            • Un-Display: PERFORM-ACTION-ACTIVE-LINK 65536
            • Window Close: PERFORM-ACTION-ACTIVE-LINK 32768
            • Copy To New: PERFORM-ACTION-ACTIVE-LINK 131072
            • Window Loaded: PERFORM-ACTION-ACTIVE-LINK 262144
            • Interval: PERFORM-ACTION-ACTIVE-LINK 524288 < interval>
            • Event: PERFORM-ACTION-ACTIVE-LINK 1048576
            • Table Refresh: PERFORM-ACTION-ACTIVE-LINK 2097152 < field_ID>
            • Hover On Label: PERFORM-ACTION-ACTIVE-LINK 4194304 < field_ID>
            • Hover On Data: PERFORM-ACTION-ACTIVE-LINK 8388608 < field_ID>
            • Hover On Field: PERFORM-ACTION-ACTIVE-LINK 16777216 < field_ID>
            • Expand: PERFORM-ACTION-ACTIVE-LINK 33554432 < field_ID>
            • Collapse: PERFORM-ACTION-ACTIVE-LINK 67108864 < field_ID>
            • 3. Re: Is it possible to trigger "Enter" (same as keyboard Enter) through Activelink?

              Hi Fred & long,

              I am not asking to trigger the workflows which have created on Return/button execution option.  I want to execute a user action similar to click of "Enter from keyboard" through Activelink , This is needed as my field able to recognize its value after click on enter. I dont want any workflow trigger after that.

              • 4. Re: Is it possible to trigger "Enter" (same as keyboard Enter) through Activelink?
                LJ LongWing

                you might be able to get it through JavaScript, but that's beyond my level of expertise.

                • 5. Re: Is it possible to trigger "Enter" (same as keyboard Enter) through Activelink?
                  Fred Grooms

                  I think both LJ and I were under the impression that you needed to fire the workflow that would happen if you pressed enter (Return) on a field.  If you type in a field and that data is not showing up at the time of submit then there is another issue going on here.

                  • 6. Re: Is it possible to trigger "Enter" (same as keyboard Enter) through Activelink?

                    Yes Fred.. It is a problem with field, it might be corrupted. But now i cant delete and re-create the field. So we are finding the ways to field recognize the value. recently we found the if user press "enter"  after provided value.its working.. so this question is posed.. Let me know if you find any way for that...

                     

                    Thanks,

                    Satya

                    • 7. Re: Is it possible to trigger "Enter" (same as keyboard Enter) through Activelink?
                      Mohammad Rehman

                      Hi Satya,

                       

                      Both Fred Grooms and LJ LongWing gave you the right solutions but I think there might be a workflow firing or validating when user press enter on that field and that may populate the some values on hidden field. You can turn on the active link log  and capture what is happening. You can make that field required as well which will force user to provide values and highlight the field to provide the value.

                      I am sure you are aware of the changing the field display properties.

                      • 8. Re: Is it possible to trigger "Enter" (same as keyboard Enter) through Activelink?

                        Hi Mohammad Rehman,

                        I have verified by taking Activelink logs, No workflow is triggerring  on return of the same field. And this field is already having "Process required" property, so only it is giving error on submit( as it could not identify the given value). we were investigated the issue & concluded that the problem is with field only, because another fields having same properties & validations are working well. As I mentioned above, I am looking for triggering "enter" through workflow, not to retrigger the existing workflows on return or something. Hope you understood the issue.

                         

                        Thanks

                        Satya

                        • 9. Re: Is it possible to trigger "Enter" (same as keyboard Enter) through Activelink?
                          Mohammad Rehman

                          Hi Satya Dattavendra Sundaraneedi,

                           

                          Would you please share the error and screenshot to get the visual. Sometime visual activate the brain.

                          Also if possible workflow screen shot where it is working and where it is not working.

                          Both fields database and display properties as well.

                          Thanks

                          Mohammad

                          • 10. Re: Is it possible to trigger "Enter" (same as keyboard Enter) through Activelink?
                            Laurent Matheo

                            You could indeed do some javascript stuff...

                             

                            Add in the form (Display->Web Header Content) a javascript function, something like (taken from the web...):

                            The field 536870918 is the field you want to "send" Enter key:

                             

                            <script language="javascript">
                            //sending Enter key to field "536870918".
                            function send_enter()
                            {
                              var press = jQuery.Event("keypress");
                              press.altGraphKey = false;
                              press.altKey = false;
                              press.bubbles = true;
                              press.cancelBubble = false;
                              press.cancelable = true;
                              press.charCode = 13;
                              press.clipboardData = undefined;
                              press.ctrlKey = false;
                              press.currentTarget = $("#arid_WIN_0_536870918")[0];
                              press.defaultPrevented = false;
                              press.detail = 0;
                              press.eventPhase = 2;
                              press.keyCode = 13;
                              press.keyIdentifier = "";
                              press.keyLocation = 0;
                              press.layerX = 0;
                              press.layerY = 0;
                              press.metaKey = false;
                              press.pageX = 0;
                              press.pageY = 0;
                              press.returnValue = true;
                              press.shiftKey = false;
                              press.srcElement = $("#arid_WIN_0_536870918")[0];
                              press.target = $("#arid_WIN_0_536870918")[0];
                              press.type = "keypress";
                              press.view = Window;
                              press.which = 13;
                            
                            
                              $("#arid_WIN_0_536870918").focus();
                              $("#arid_WIN_0_536870918").trigger(press);
                            
                            
                              return true;
                            }
                            
                            
                            </script>
                            
                            

                             

                            Then to call the "send_enter" function, you need to create an active link, with a "run process" action:

                            javascript send_enter()

                             

                             

                            Though, if the field doesn't get the value, this sounds more like a bug from the mid-tier... It sounds like the value is indeed in the field but not in the BMC object, javascript side...

                            That's why when you want to "send" data to a text field in javascript, for BMC, you don't use "standard" javascript function, but rather BMC ones (Set / Get) .G() or .S().

                             

                            If this doesn't work, another idea would be to read the input field and "rewrite" the value in it, something like:

                            <script language="javascript">
                            function rewrite_field()
                            {
                              var my_val=$("#arid_WIN_0_536870918").val();
                              var my_txt=$("#arid_WIN_0_536870918").text();
                              var real_value="";
                            
                              //Debug
                              alert("val: " + my_val);
                              alert("txt: " + my_txt);
                            
                              real_value=my_val;
                              if (real_value=="")
                              {
                              real_value=my_txt;
                              }
                            
                              F(0,536870918).S(new CharType(real_value));
                            
                            
                            
                              return true;
                            }
                            
                            
                            </script>
                            
                            

                             

                             

                            The idea here is to read the value, not from "BMC" object but from the input itself, and to "rewrite" the value, in the BMC object itself.

                            The two "alert" are just here for debug purposes.

                             

                            Actually I would go first for the second thing rather than the first...

                            1 of 1 people found this helpful
                            • 11. Re: Is it possible to trigger "Enter" (same as keyboard Enter) through Activelink?
                              Doug Mueller

                              My concern here is that you are pursuing the wrong solution.

                               

                              You have a problem where some logic is not working correctly in your  application.  You have found a workaround and are trying to institutionalize the workaround.  That is not the rigth approach.  You need to find out what logic is not working correctly in your application.  There is clearly some logic that is not working correctly because you are getting different behaviors in the two different circumstances.

                               

                              So, you need to turn on active link logging and see what logic is performed in the different scenarios.  Is there something happening on return on the field in question that is not happening when you enter a value and hit Submit?  What field exactly is getting the error.  Have you double checked that it is the field you think it is that is the one it says does not have the value?  Are there multiple fields with the same label so there is confusion?

                               

                              Solving the logic problem would eliminate the error so you don't need the workaround.

                              • 12. Re: Is it possible to trigger "Enter" (same as keyboard Enter) through Activelink?
                                Saroj Sahu

                                I think it will be helpful if you narrate the actual problem in a little bit more detail. The problem may not be with the field, rather it may be with the workflow that you have written to be fired on this field. As you said no workflow is returning, that means the association of the workflow with the field is not there.

                                 

                                I would suggest to check the below and publish the outcome.

                                1. Open the form in dev-studio and select the field.

                                2. Right-click on the field and select "show workflow". Does it show the event for which the workflow is written. If not there is a problem that the field and the workflow are not associated with each other properly. Fix the workflow or re-write the workflow.