Thursday, November 8, 2012

Insert text at current cursor position


ADF provides  <af:insertTextBehavior> component to insert text at  current cursor position
This tag is an alternative for java script.

To demonstrate <af:insertTextBehavior> tag ,
let's have a scenario with two input texts and a command button.

On click of  'Insert'  button, InputA value("AND") will be inserted at the current cursor position of InputB.



Below snippet is used for acheiving this task:




 <af:insertTextBehavior>  is used with Command button component  to insert text on click of command button.
<af:insertTextBehavior> tag attributes:
for-destination component id .
triggerType- The event type which will trigger the text to be inserted.

For more information on <af:insertTextBehavior> tag attributes , Click here.





3 comments:

  1. Is partial triggers on command button rally necessary? on auto-submitting 'it1', viewscope variable(inputA) gets updated right?
    --
    Harsha

    ReplyDelete
  2. It is necessary as we are referencing viewscope value in af:insert.... tag , this should get refreshed.

    ReplyDelete