Extension of JavaScript causing a reload of the page

Hello

I created an extension of fast, based on dialogue by Tim Neil spinner code I found here https://github.com/tneil/WebWorks/tree/master/api/ui/Spinner/src/blackberry/ui/spinner

Now, I have a basic function that takes a string and returns in a callback. This will be modified later to take a path of the image and returns a string containing an image of the data encoded in base64.

Including the html from the application and function extension containing a script below.

My problem is that on the successful recall, my 'onLoad' fuction is called again.

Is there anyway to stop this happenning. OR I'm doing something wrong.

See you soon.







Invoke Extension




///===================================================

public final class FunctionTest extends ScriptableFunction {
    public static final String NAME = "myfunction";
    private ScriptableFunction _callback = null;

    public Object invoke(Object obj, Object[] args) throws Exception
    {
        if (args.length == 2) {
            String strPath = (String)args[0];
            // Now get the callback method to fire
            _callback = (ScriptableFunction)args[1];

            Object[] result = new Object[1];
            result[0] = strPath;
            // Create a final thread safe result to pass into the thread object
            final Object[] threadedResult = result;
            // Create a new thread to make sure that the invoke of the JavaScript callback
            // does not initiate from the UI thread.  This can otherwise cause a deadlock scenario
            new Thread () {
                public void run() {
                    try
                    {
                        // Pass the result of the spinner back to the handle of the JavaScript callback
                        _callback.invoke(_callback, threadedResult);
                    }
                    catch (Exception e) {
                        throw new RuntimeException(e.getMessage());
                    }
                }
            }.start();

        }

        return UNDEFINED;

    }

Reloading is caused the href = "" in your anchor tag. " A href empty, the page reloads. Try to use a button to trigger your code instead:

Tags: BlackBerry Developers

Similar Questions

  • JSF HTML Command Button: Prevent reloading of the Page

    I know that for ADF Faces major command buttons, you can set partialSubmit to true to prevent the reload of the page. I need to do the same thing for a JSF HTML command button, but there is no such property. I want to really just change the properties of the button when it is selected using javascript. I don't want anything to show up at all. Is it something I could set the action property to prevent this?

    Thank you
    Tim

    Tim,

    Try this instead:


    Binding = "#{backing_Test.commandButton3} '"
    ID = "commandButton1."
    onclick = "return false" / >

    I hope it will work for you,

    Brian

  • How can I move the button reload of the page in firefox OSX for next to the back button where it was before I updated.

    How can I move the button reload of the page in firefox OSX for next to the back button where it was before I updated.
    I know there is an addon for windows Classic theme, but I need a fix for osx... its very frustrating when you update and things like this change and can be customized to the way we are used to using the browser. his counter intuitive to have the page button refresh so far from the back and home buttons.

    never mind, I found the preferences in the addon manager... Thanks again!

  • JavaScript: box always invalid after the page

    Hello

    In a region, I have a check box that must be disabled by default. After clicking on a button that applies a MRU/present (and verification of certain conditions) the box should switch to on.

    What I did:
    -The Javascript of the enableCheckbox() and disableCheckbox() functions are defined in the HTML page header (they work).
    -In the foot of the region with the box I call the function disableCheckbox ('myCheckbox'); to get the default value.
    -The optional URL redirection of the button says:
    JavaScript:doSubmit('SUBMIT'); to submit
    JavaScript:enableCheckbox('myCheckbox'); to activate the checkbox

    The problem is that the box will switch on, because submit/reload the page to disable the checkbox through the foot of the region. Think of other solutions, I realized that each top up will set the default again...

    How can that be resolved?
    Thanks in advance,

    Roger

    Hi Roger,

    You must have somewhere a logic that determines if the checkbox should be disabled/enabled.

    Generally speaking, it would be the value of one or more fields and the box should be checked whenever the field related (s) is / are updated using the onchange event.

    There are several ways to check for this, but the principles would be the same. For example:

    function check()
    {
     var x = document.getElementById("P1_PAGEITEM");
     var c = document.getElementById("P1_CHECKBOX");
     if (x.value == 'XXX')
     {
      c.disabled = false;
     }
     else
     {
      c.disabled = true;
     }
    }
    

    This function can be used on the page loading - by adding a call to it in Footer region region - and the attributes of the P1_PAGEITEM using:

    onchange="javascript:check();"
    

    Andy

  • How can I stop Firefox displaying Javascript/CSS inline when viewing the Page (CTRL + U) Source?

    Recently, I noticed that the Javascript and CSS files are shown online while you watch a page source. Is there a way to stop the Firefox to do this?

    Thanks for the test.

    When I try Reddit, this stylesheet is not inline in the page.

    I can't access/browsing Netflix, I'm redirected to a login screen. But it seems strange that when I try to navigate around Netflix, I'm still on HTTPS and you load on HTTP.

    This problem happens only in the pages of HTTP and not HTTPS pages?

    Is it possible that some sort of proxy or security filter modifies the page until it reaches your browser?

  • Date.MinValue causes other methods on the page to be executed

    Hi smart guys,.

    I have a page with a form that has some text fields and a date component. MinValue ADF ADF. I have a below submit button which, when clicked, executes the setSomething method.
    I realized that when I click the date component. MinValue to choose the date, the setSomething method is executed... It is too early and causing undesirable behaviors.
    Is there a way to set the setSomething method ONLY works when the clicking the button send (or at least block of running when handling with the date component. MinValue)?

    Thank you very much.

    using JDeveloper 11.1.1.3

    You can try something like this (I have not tried yet).
    1. define a scope pageFlowScope/View setting when you press the command button.
    2. in the actionListener/action method, find the defined parameter. If it satisfies the condition (the value is set), the execute method, otherwise ignore.
    3 reset the parameter when the action listener method is complete.

    It will be useful.

  • JavaScript from the page as an argument element

    It is a simple javascript function to remove the space on the P6_JOB_NAME text field

    I want to move the agenda of the APEX page as an argument so that I can reuse this same javascript on several elements of the page function.

    I tried several different ways, as below. But none of them works. No idea where I am going wrong?

    1 work

    function removeSpace() {}

    job_name var = document.getElementById ('P6_JOB_NAME');

    var input_str = job_name.value;

    job_name. Value = input_str.replace (/ \s + / g, ");

    }

    in the text field...

    onChange ='Javascript:removeSpace();'

    2. does not work

    function removeSpace (id) {}

    job_name var = document.getElementById (id);

    var input_str = job_name.value;

    job_name. Value = input_str.replace (/ \s + / g, ");

    }

    in the text field...

    None of these works

    onChange = 'Javascript:removeSpace (this)';

    onChange = 'Javascript:removeSpace('P6_JOB_NAME')';

    Hi JonDaegu-Oracle

    Try using the following code, I didn't test, but I think it will work

    function removeSpace (id) {}

    var input_str = id.value;

    ID. Value = input_str.replace (/ \s + / g, ");

    }

    Concerning

    Salim

  • Page updated authorization in place on the Page zero

    Greetings to the community!

    When you define an authorization scheme, you can set as a condition for the security of a page. -You on each page individually.

    Now, I want to have a permission of page for each page on the App and there are a whole bunch of pages, so zero Page comes to mind. However there is no direct way to set a permission of page on the zero Page, or skip logic, so I've found a workaround:

    -> Process A Page zero to validate authentication page setting, APP_USER, and APP_PAGE_ID
    -> Year App-Item to store this result, say APPI_PAGEAUTHORZ,
    -> Dynamic Action on the Page zero, according to the value of APPI_PAGEAUTHORZ performed a redirect to the home page.
    -> There maybe an appropriate error according to the value of APPI_PAGEAUTHORZ.

    It works, but one) I'm not sure about the safety - you could disable javascript and you have all the pages on the url, and b) it seems a bit complicated and funky.

    So, I would ask you, if there is a better way to do this.

    Thank you and best regards,
    Tobi

    A scheme of application-level authorization is defined using the attributes of application security, no Page zero.

  • Safari 9.0.2. I find safari hangs and does not open pages as it should. Blue progress bar moves to half way then stops. Reload the page do me later, but it is slow. No idea what's causing the problem. WiFi is good.

    Safari. When opening a site, the page frequently does not. The blue progress bar moves about half way and then stops. I can get to move usually by reloading the page, but it's slow and frustrating.

    It does occur on a particular site. Now, it seems to be fairly general.

    WiFi is good so I don't think that's the problem.

    Any ideas?

    Go step by step by step and test.

    1. turn off the power to the router. Unplug it from the wall. Wait a while.

    Plug it in, back to the wall. Turn on the router. Wait for all lights are light up properly. It will take a while.

    Restart the computer.

    Boot mode safe.

    https://support.Apple.com/kb/PH18760?locale=en_US

    2 remove Caches.db

    Close all windows and close all applications.

    Hold down the 'option' key, then click on the "Go" menu in the Finder menu bar.

    Select 'Library' in the menu dropdown.

    Library > Caches > com.apple.Safari > Caches.db

    Right-click on the Caches.db file and select "move to trash".

    Close the windows.

    Restart and restart Safari.

    3 empty Caches

    Safari > Preferences > advanced

    Tick the box "Show develop menu in menu bar."

    Develop menu will appear in the Safari menu bar.

    Click on develop and select 'Empty cache' in the menu dropdown.

    4. remove the Cookies

    Safari > Preferences > privacy > Cookies and other data from the website:

    Click on the button "Details".

    Delete all cookies except those from Apple, your internet service provider and the banks.

    5 Disable Extensions and test them.

    Safari > Preferences > Extensions

    Uncheck 'Enable the Extension' and test.

    Enable the Extensions one by one and test.

    To uninstall any extension, select it and click the "Uninstall" button

  • Questions about the Extension of JavaScript and SQLite

    Hi all

    I worked with some my colleague on projects related to WebWorks applications, but there are technical issues that our developers want to know and seek professional advice.

    (1) extension JavaScript & PlayBook

    According to the literature, we know that BlackBerry WebWorks Application have the ability to integrate with data, characteristics and features of the development environment Java® underlying as well as the native phone smart BlackBerry® using special JavaScript® (Extension of JavaScript) objects. So, we should be able to create® for Java (JAR) libraries and program the WebWorks app for BlackBerry Java API to call in libraries. Now, we know that BlackBerry® PlayBook provide a SDK WebWorks (Beta) for us to develop apps for PlayBook WebWorks, also means that in the environment of the PlayBook we can also use the JavaScript Extension trick to call the Java API of BlackBerry?

    (2) SQLite on HTML5

    HTML5 standard offer of SQLite for us to store data in a SQLite database format. But the SQLite file seems limited only to be used in the Application of WebWorks. I wonder if there are ways we can read these file to another application (Application Java or other applications WebWorks) SQLite?

    In fact, what I want to know is the possibility of having a WebWorks Application capable of handling a SQLite file that is received from the server side on-the-fly, and then return the entire SQLite file to the server.

    It would be appreciated if some of you can give some tips about this, thank you.

    Wowzzz

    lasterra is right about these two points...

    We have not yet published the details on creating extensions in the AIR for WebWorks on PlayBook. We are currently working to finalize the open source on the WebWorks for PlayBook SDK so that we can download on github.  The complete source code for the platform will be available on github so that you can see what's going on under the hood.

    Creating extensions in the AIR for WebWorks is very different from Java. We started to use a new architecture that should be able to provide the URI and proceedings access to APIs and placing more procedural API code in JavaScript itself vs. the ScriptableObject Java code existing today.

    This new architecture will be a foretaste of the platform architecture WebWorks to proceed.

    It welcomes more details about creating extensions in the AIR... but currently the API underlying main platform on the BlackBerry PlayBook is AIR and the functionality of an extension will be limited to what is possible on the AIR platform and its extensions.

    In the development of the PlayBook options evolve, so too will be the architecture of the platform WebWorks... I can't really say much more than this now

  • Extension of the user interface - javascript does not come to the top


    Hello

    I'm on PLM6.1.1.5 and EP 3.11. I followed the implementation of measures to extend the user interface:

    Step 1. copy the files:

    Copy the Utilities\UIExtensions\config\Core\UIExtensionScripts directory and its contents in the \config\Core < PLM4P_Home > directory

    Copy the Directory of Utilities\UIExtensions\config\Extensions\UIExtensionScripts and its content in the directory of \config\Extensions < PLM4P_Home >

    Copy the following assemblies to the SharedLibs folder of the the Pack of extensibility in the \Web\scrm\bin < PLM4P_Home >, < PLM4P_Home > \Web\gsm\bin or < PLM4P_Home > \Web\npd\bin directories:

    • PLM4PExtensionUtils.dll
    • ScriptingUtils.dll
    • UserInterfaceExtensions.dll

    Step 2: Insert the following lines in CustomPluginExtensions.xml, in the FormatPlugins section

    < name of the Plugin = "UIExtensionGSM."
    FactoryURL = "class: Oracle." Agile.PlmProcess.UserInterfaceExtensions.Java
    scriptLoaderFormatPluginFactory, UserInterfaceExtensions$ NameValuePair: FormatPluginNames = GSMSpecJavaScriptPlugin & amp; ScriptFiles=config\\Core\\UIExtensionScripts\\static\\UIExtensionsCore.js,config\\Extensions\\UIExtensionScripts\\static\\GSM_Variables.js ".
    / >

    < Plugin
    name = "GSMSpecJavaScriptPlugin" FactoryURL = "class: Oracle." Agile.PlmProcess.UserInterfaceExtensions.GSMSpecJava
    scriptFormatPluginFactory, UserInterfaceExtensions$false"/ > ".

    Step 3: update the \config\Extensions\UIExtensionScripts\UIExtensionsConfig.xml file to enable the specific extension points.

    UIExtensionGSM default has been activated.

    4:go to step < PLM4P_HOME > \config\Extensions\UIExtensionScripts\Static, has used the sample for customization 2147.js.

    None of my javascript are applied to the page. I tried simple javascript like this:

    ($(window) .load)

    function() {}

    Alert ("hello world");

    }

    );

    in 2147.js, 1004.js, 1009.js. Nothing came

    All the steps that I missed

    Thank you

    Church

    You said that by default uiextensiongsm has been activated. But I have to manually turn on UseInEditMode and UseInReadMode. Please check this.

  • Adjust a URL and the reloading of the causes for go to Google - sort of just let the page reload?

    I was testing calls to a Solr index with different URL query parameters. But whenever I have a setting and reload the page, instead of making the call again once I fell into Google search.

    However, if I have (laboriously) manually change the URL to add specifically in "http://" at the beginning of the line I can reload the page.

    This does not happen in Safari or Chrome. It seems to be a problem specific to FireFox.

    She adds tests and I was wondering if there was a solution for this.

    Thank you

    Doug

    I forgot to mention that you can by default the http:// at the beginning of the URL. I did if for a long time, there it just happened for me.

    (1) in a new tab, type or paste Subject: config in the address bar and press ENTER. Click on the button promising to be careful.

    (2) in the filter box, type or paste the trim and take a break while the list is filtered

    (3) double-click browser.urlbar.trimURLs to change its value from true to false. You have done here.

  • Action and ActionListener cause the page reload?

    I have a long page where the user must scroll down to go through all the components of the page. on the page, I have a button when the user presses it the value of an text box will be added to the table of the ADF , where the user can see in the page.

    Problem is when the press user, the button of the page reloads. It's when the button is pressed, the control passes the top of the page. I tried to use the Action and ActionListener (each one separately) and again, I get the same result.

    Any ideas to prohibit control to the beginning of the page, because it is not easy to use.

    I use Jdeveloper 11.1.2.3 with the technology of the ADF and JSF pages

    Hello

    tried to set partialSubmit of the button to true or use toolbarButton (including the default value for partialSubmit = true)?

  • When I click on certain links on the amazon sites, that nothing is happening. The javascript:void (false) message in the southern corner of the left side of the screen.

    This only happens in the amazon website and specifically in the shopping cart page when you press the 'delete' or 'save for later' options. The message even before as I click on the option. »

    This usually indicates a JavaScript onclick action that does not work. Such a link can also be added by a jQuery script after the page load is complete.

    Clear the cache and cookies from sites that cause problems.

    "Clear the Cache":

    • Firefox > Preferences > advanced > network > storage (Cache) offline: 'clear now '.

    'Delete Cookies' sites causing problems:

    • Firefox > Preferences > privacy > Cookies: "show the Cookies".

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

  • Closing "Firefox prevented this page automatically reloading" allows the auto-recharges. or continue to deny, but without informing you?

    In Options/Advanced/general Options, that I 'Warn me when websites try to redirect or reload the page' selected.

    However there are some cases - for example, when a page has me 'pending' temporarily when the site is too busy ("we're going to keep you in the queue and will warn you if the website is available"), with the "Firefox prevented this page automatically reloading" bar appears in the upper part.

    If I left the bar remain without any intervention on my part, can the page REALLY let me know when the site is available? Or how about if I click Close (X) on the bar, which in fact disappear. Is Firefox and then allowing the page reload, or is it always block but just to remove the notification that it is done? (A third choice, by clicking the "Authorize" button is essentially useless in this case because it just instantly reappears.)

    Bottom line, I strive to make sure the page that's too busy REALLY can let know me when it is available, without having to change all of the global settings.

    Said Rick216

    If I left the bar remain without any intervention on my part, can the page REALLY let me know when the site is available? Or how about if I click Close (X) on the bar, which in fact disappear. Is Firefox and then allowing the page reload, or is it always block but just to remove the notification that it is done?

    If you do not click allow, Firefox will ignore a metatag to refresh as follows in order to reload the page every 30 seconds:

    <meta http-equiv="refresh" content="30">
    

    But as you point out, by clicking on allow made that immediately reload the page and the same triggers InfoBar again. One of the many reasons that this feature is more trouble that it's worth.

    If you leave the display bar or if you 'x' of the bar, the scripts can always reload the page. In other words, this function does NOT stop something similar to the following to reload the page every 60 seconds:

    <script type="text/javascript">
    window.setTimeout(function(){window.location.reload()}, 60000);
    </script>

    So what is happening on the page in question depends on how it is designed.

Maybe you are looking for

  • about activate topping on macOS sierra

    Hello After that I upgraded the macos to sierra, the operation is not smooth. So I bought a samsung ssd 850 evo, and I'll change the HHD to the SSD. How can I use terminal to allow the trim on the sierra? and is it necessary to activate the trim for

  • Satellite A300 - cannot find the drivers for Windows 7 64 bit

    Hello!I'm of the Greece so I apologise for any errors of syntax, I can do.My girlfriend has the Satellite A300 PSAJ4E but his hard disk was destroyed, so I bought him a new (WD Scorpio Black 500 GB) and I downloaded the original Windows 7 MSDNAA to i

  • No sound after updates

    I use a HP Envy TS m6 Sleekbok running windows 8.1 64-bit.  It is only my second day using this computer and asked do updates from HP to it, I have no sound?

  • EliteBook 8540p: Base system device driver

    Greetings, I recently updated my laptop to Windows 8.1.  When I went to the Device Manager, I noticed a question mark next to "other devices".  When I expand it, it shows two options for "device Base system and both have the Exclamation Points next t

  • HP deskjet 3650 driver - where can I find the replacement?

    I lost the disk that comes with the printer and can't seem to download it.