cancel
Showing results for 
Search instead for 
Did you mean: 

bsp find and replace tag

Former Member
0 Kudos

Hi,

I want to know how to use find and replace tag of BSP.Actually my requirement is onchange of value in Input field i want to calculate somthing.Can any body help me.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

solved

Former Member
0 Kudos

This looks pretty weird in coding ^^

I would solve this issue with javascript only:

function onLoad(){
     document.getElementById('myInputField').on'keyup = function(){startTimer();};
}

var timer = null;
function startT imer(){
   if(timer != null){
      window. clear'Timeout(timer);      
   }
   timer = window. set'Timeout("timerTick()", 3000);
}

function timerTick(){
   // calculate whatever you want
}

When the user enters something in the myInputField a timer is startet. As soon as no key is hit for a minimum of 3 seconds, the calculation is done.

I had to add the ' to the javascript functions because I get an error from the forum without...

Former Member
0 Kudos

Hi all,

This is a good idea Michael! I would just have simplified it by using the following:

function onLoad(){
     document.getElementById('myInputField').on'change = function(){getVal();};
}

No need of timers then!

Regards,

Tanguy

former_member184111
Active Contributor
0 Kudos

Hi Suman,

<bsp:findAndReplace find    = "<input"
                          replace = "< i n p u t   o n C h a n g e = c a l c v a l ( ) ;   > 
        <htmlb:in p u t F i e l d   i d          = "ip"
                          va l u e           =   " < % =   r e q u e s t - > g e t _ f orm_field( 'ip' ) %> "
                          alignment = "left" />
      </bsp:findAndReplace>

you can write a fuction in JS for your calculations.

Regards,

Anubhav.

Former Member
0 Kudos

Hi Anubav,

i am getting some text beside my input field in the output and more over event also not triggering.check my code

<bsp:findAndReplace find = "<input"

replace = "<i n p u t o n C h a n g e = g e t V a l ( ) ; > " >

<htmlb:i n p u t F i e l d i d = "ip1"

v a l u e = "<% = v a l u e 1 % > "

a l i g n m e n t = "left"

/>

</bsp:findAndReplace>

former_member188685
Active Contributor
0 Kudos

check this sample...

< % @ p a g e language="abap" %  >
< % @ e x tension name="h t ml b" prefix="h t ml b" %  >
< % @e xt ens io n nam e="bsp" pr efix="b sp" % >
< ht m l b:c ont  ent d esig n="desi gn2 0 03  ">
  < ht mlb  :page  title = " " >
    < ht  mlb:fo rm >
< % d ata: v al(10) .% >
      < ht m   lb:textView     text          = "Hello World!"
                          design        = "EMPHASIZED" />
< bs  p:findAndReplac  e find="<input"
      re p lac e="< input onc hange = `  al ert(  'ale  rt'  )`" >


          <  h t  mlb:in pu tField   id="i1" value="<%= val %> " / >

< / b sp:findAndRe place >

      < h t  ml b:b utto n       text          = "Press Me"
                          onC  lick       = "myClickH andler"  / >

     < /h tm lb:f or m  >
  < /  h tm  lb:p  a g e >
 < /  h t ml b:c on ten  t >