function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ShivaShiva 

How can I display message box?

I have custom page and I would like to display message box after some task is done.

 

How can I do that?

 

Thanks

 

yuyinchayuyincha

message box?

 

as like this?

 

in page:

<script>

if('{!showMessage}'=='True'){

alert('your message!');

}

</script>

in controller:

 

public String showMessage{

 get;

set;

}

 

public void actionDo(){

//do something

showMessage='True';

 

}

XactiumBenXactiumBen

You might have to create the javascript as a function then when the action has been completed call the function.

 

Example:

 

<apex:commandButton action="{!actionDo}" value="Do Something" oncomplete="showMessage();" />

 

yuyinchayuyincha

example:

 

visualforce code---

<apex:page controller="PageTest">
<script>
if('{!showMessage}'=='True'){

alert('your message!');

}
</script>
<apex:form >
<apex:commandButton action="{!actionDo}" value="Do Something"/>
</apex:form>
</apex:page>

 

apex class:

 

public class PageTest{

 

public String showMessage{

get;

set;

}



public void actionDo(){

//do something

showMessage='True';



 

(passed my test)use these code to test..    you will success..   hehe.  祝你好运!。  ^_^.