Search code examples
rhomobilerhodes

How to define User defined buttons in alert for Rhomobile Application


I have been using WebView.execute_js() to popup some message or data as like below

WebView.execute_js("alert('"+message+"')")

But our client had specified to have custom buttons for the alert box. Do we have any way to make this success.

Please make some sample code, as i'm totally new to this framework.

Thanks


Solution

  • You can use Alert.show_popup() to accomplish this requirement.

    Alert.show_popup( {
        :message => 'Some message', 
        :title => 'Custom title', 
        :icon => '/public/images/icon.png',
        :buttons => ["Yes", "No"] } )
    

    Hope this helps you in brief http://docs.rhomobile.com/rhodes/device-caps#alerts