Form1.reset() = Uncaught Error

Form1.reset() = Uncaught Error

jquery3.js:2 Uncaught Error: cannot call methods on selectmenu prior to initialization; attempted to call method 'refresh'
    at Function.error (jquery3.js:2:2741)
    at HTMLSelectElement.<anonymous> (jquery.UI_1.12.1.js:246:16)
    at Function.each (jquery3.js:2:3129)
    at ce.fn.init.each (jquery3.js:2:1594)
    at $.fn.<computed> [as selectmenu] (jquery.UI_1.12.1.js:236:10)
    at reset (appstudioFunctions.js:626:51)
    at reset (appstudioFunctions.js:578:13)
    at reset (appstudioFunctions.js:578:13)
    at reset (appstudioFunctions.js:578:13)
    at reset (appstudioFunctions.js:578:13)

Not enough information here to be sure, but one thought is that you are doing the Form1.reset() before the form is fully instantiated.

This can happen at startup of your app. You can avoid this by not doing it until Main() has been executed.

It only errors if I have a bs4 Select control in the form.

A new one regarding the BS4 Select Control on iOS = If a Select item text is longer than the screen is wide, when that item is selected it makes the entire inner screen the same width, hence it now has a large left and right scroll. Android is ok.

I think I got it. There were lots of the slanted quotes in my HTML that were not being interpreted correctly. Gotta find a better text editor.

Thanks, Mark

@markebell - could you be replying to the wrong question on forum? If you mean to reply to “HTML in a container”, you should post there. (And yes, this could be the explanation for what you are seeing)

@Pro_Certs - I tried reproducing your issue.

  1. new project.
  2. add a BS4 Select.
  3. Run.
  4. in the console, type Form1.reset(). It works properly.
  5. Add the following line to Global Code:
Form1.reset()
  1. Run again

This time I get the same error you did. You’re calling reset() before the form has finished being created.

Ah ok, I was testing it in the browser. Each time I re-ran “Start in Desktop Browser”, the current form in the browser would refresh, rather than reload from the firstform:

For example,

  1. Run “Start in Desktop Browser”, in the app navigate to a different Form.
  2. Run “Start in Desktop Browser” again = the current form in the browser would refresh ← I was testing functions on this form.

So I guess I need to nav back to the first form before running Start in desktop Browser.

I was calling Form1.reset() on a button click.

Would you chk the start up form you set up,may be you mess it up…