cancel
Showing results for 
Search instead for 
Did you mean: 

Can I trigger a javaScript on change of a htmlb:inputField?

former_member498918
Participant
0 Kudos

Can I trigger a javaScript on change of an htmlb:inputField? You can do this in the dropdownListBox by using onClientSelect. I want to trigger a javaScript function when a field in an htmlb:tableView is changed.

Can anyone help?

Karen

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

hi all

I just finished my second article on this subject. The first covers the issue using on JSP and EP 6.0:

http://variant.ch/phpwiki/WikiBlog/2005-01-31

the second article shows how to deal with the problem using BSP on SAP R/3 WAS:

http://variant.ch/phpwiki/WikiBlog/2005-02-01

I hope this helps anyone.

regards

nicola

Former Member
0 Kudos

Karen, use something like this:

document.getElementById("myInputText").attachEvent("onchange", myScriptFuncion);

Best Regards,

Ariel

maximilian_schaufler
Active Contributor
0 Kudos

Talking bout weblogs ... I just did some quick testing regarding this additional event topic, and decided to follow Brian's call and write a short blog about it.

Will be a short instruction on how to take care of events in a somewhat elegant way - sure not the best solution or the last word on this, but hope to transport some of my thoughts on this.

Former Member
0 Kudos

Sounds good Max!

Thilo
Explorer
0 Kudos

In MS Internet Explorer you can use the "named script" like this:


<htmlb:inputField id   = "Inp123"
                 value = "//model/edit_wa.pvo_ad_1"/>
<script for="Inp123" event=onchange type="text/javascript">
  YourJavaScriptFunc( this );
</script>

Don't know if this works in other browsers too.

Thilo

former_member181879
Active Contributor
0 Kudos

This collection of threads are just starting to beg for a weblog. My suggestion would be to look at the .attach approach. See other thread. The findAndReplace is not something I would recommend (to much).

Former Member
0 Kudos

see for a proper solution. there is no need for a dirty hack like proposed by some people...

regards

nicola

Former Member
0 Kudos

Nicole, nice example although did you have a small typo? "JSP" did you mean JSP or BSP, if you did mean JSP which by the way your code does look like you do mean JSP then your solution isn't a BSP solution at all is it?

As for your idea of a "proper solution" well as we all know that is a relative statement. If it works then it is proper if you have time to change your code when something comes along that works as well or better then go for it and now that is proper.

Remember we are all here to help and not "bash" other solutions because we feel that ours is a more "proper solution" we're all here to help and we are all learning each and everyday.

maximilian_schaufler
Active Contributor
0 Kudos

Hi Karen,

I came across your post now, let me know if you are still looking for an answer (hopefully you kept reading SDN) - got a way to do so.

Regards,

Max

Former Member
0 Kudos

Post your way Max!

maximilian_schaufler
Active Contributor
0 Kudos

Ok, just quick and dirty posted, explanation will come in a weblog (together with other small extras).


<% tmp_string =`<input onChange="javascript:yourFunctionHere();"`. %>
<bsp:findAndReplace
	find    = "<input"
	replace = "<%= tmp_string %>">
<htmlb:inputField
	id             = "..."
	..... />
</bsp:findAndReplace>

Former Member
0 Kudos

Hi Karen,

Get a look on attribute SubmitOnEnter perhaps that should solve your problem .

Regards.

Bertrand