0

How to change the src of <include> on click of a button?

asked 2015-04-27 18:06:16 +0800

sidharthchh gravatar image sidharthchh
3 1

I want to change the src value of a include tag on click of a link. Or a probable solution that i want is to show or hide an element in zul on click of a link.

delete flag offensive retag edit

Comments

mvc or mvvm?

chillworld ( 2015-04-27 18:14:23 +0800 )edit

trying mvc

sidharthchh ( 2015-04-27 20:16:53 +0800 )edit

echarish: I am getting a null pointer exception on setSrc()

sidharthchh ( 2015-04-28 03:40:54 +0800 )edit

Did you wired the include correct?

chillworld ( 2015-04-28 05:04:45 +0800 )edit

Please check if your include object is being wired properly, if you are using mvc than check the spelling of id in your include, if you are using mvvm you have to get the object of include and change it.

echarish ( 2015-04-28 05:31:04 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-04-28 02:30:01 +0800

echarish gravatar image echarish flag of Japan
1809 7
http://jp.linkedin.com/in...

Hello

Add a eventlistener to your button for onclick event and change the src of your include.

I have created a fiddle to do the same

http://zkfiddle.org/sample/3niieig/2-Include-SRC-change-on-button-click

Here is the API for setSrc of include. http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zul/Include.html#setSrc(java.lang.String)

Harish

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-04-27 18:06:16 +0800

Seen: 28 times

Last updated: Apr 28 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More