Client side error

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Dave, Jon, Steve, Ian

Segi
Ebase User
Posts: 590
Joined: Mon Dec 09, 2013 6:37 pm

Client side error

#1

Postby Segi » Thu Nov 01, 2018 6:30 pm

I have a product configurator form. When it loads a specific product page (and only this one specific product page) I noticed a client side error in the browser dev console..

The error is:

Code: Select all

Uncaught TypeError: Cannot read property 'value' of undefined
    at Object.com.ebasetech.ufs.Util.getElementValue (vldt540.js:212)
    at Object.com.ebasetech.ufs.Util.getFormValue (vldt540.js:198)
    at Object.com.ebasetech.ufs.Main.initialiseInput (ufs540.js:99)
    at new com.ebasetech.ufs.Input (ufs540.js:15)
    at Object.com.ebasetech.ufs.html.init (EPCS_FORM.eb?PCSTEMPLATEID=6&PREVIEW=false&GeneratePDF=false&PCS_CustomerPCS_ID=1&ebd=0&ebz=78_1541096461789:3456)
    at EPCS_FORM.eb?PCSTEMPLATEID=6&PREVIEW=false&GeneratePDF=false&PCS_CustomerPCS_ID=1&ebd=0&ebz=78_1541096461789:3472
Line 3471 of the form EPCS_FORM.eb refers to this javascript line: com.ebasetech.ufs.html.init(); which is causing this error.

I have javascript code in the Web Resources which I commented out to see if it was indirectly causing this error but I still get this error.

I removed 2 client scripts attached to my form under Web resources and still get this error.

I also commented out HTML code in the page HTML entities to see if it was the source of the problem but it isn't.

Any idea what is causing this to happen ?
0 x

Jon
Moderator
Moderator
Posts: 1289
Joined: Wed Sep 12, 2007 12:49 pm

Re: Client side error

#2

Postby Jon » Fri Nov 02, 2018 10:27 am

Could you export the form please and send it to support@ebasetech.com. And also let us know which page it's failing on.
One additional question: are you using any of the new HTML5 input types e.g. email etc?
0 x

Segi
Ebase User
Posts: 590
Joined: Mon Dec 09, 2013 6:37 pm

Re: Client side error

#3

Postby Segi » Fri Nov 02, 2018 3:31 pm

Jon,

Since this form is from a product configurator application, it is database driven and won't work without the database behind it.

I checked all of the fields and I am not using any of the new HTML input types for any of the fields
0 x

Jon
Moderator
Moderator
Posts: 1289
Joined: Wed Sep 12, 2007 12:49 pm

Re: Client side error

#4

Postby Jon » Fri Nov 02, 2018 5:39 pm

I don't need to run it - I just want to see what might cause the error. If you can point me to the failing page, that will be enough info.
0 x

Segi
Ebase User
Posts: 590
Joined: Mon Dec 09, 2013 6:37 pm

Re: Client side error

#5

Postby Segi » Fri Nov 02, 2018 5:59 pm

Jon,

I've been doing some client side debugging and found something. Hopefully it'll be helpful.

I traced the execution step by step until I found the exact line that throws this error. It is happening on line 212 of the library vldt540.js which reads

Code: Select all

{return element.options[element.selectedIndex].value;}
I put a breakpoint on this line so that I can inspect the variable element. It contains the HTML

Code: Select all

<select id="CTID-KMiw5vdZ-5_22-A" class="eb-KMiw5vdZ-EditorInput CTID-KMiw5vdZ-5_22-A OPTVALUES" name="CTRL:KMiw5vdZ:5_22:A" title="Optionvalues"></select>
and element.selectedIndex is -1 so element.options[element.selectedIndex].value is throwing an error because its trying to get the value of a select without validating that selectedIndex is not -1

I verified that all of the dropdowns on the form do in fact have a selected value.

If I hide the dropdown that has the class OPTVALUES, the client side error goes away. I do not have any client side code running in the HTML entities of this dropdown.


Update: I have found and fixed the source of the problem in the configuration of my application that resulted in this error (on the server side) although I think that it would be a good idea to add client side validation before trying to get the selected value of a select dropdown to prevent errors like this from being thrown.
0 x

Jon
Moderator
Moderator
Posts: 1289
Joined: Wed Sep 12, 2007 12:49 pm

Re: Client side error

#6

Postby Jon » Mon Nov 05, 2018 8:27 am

Thanks for looking into this, we'll fix it.
0 x


Who is online

Users browsing this forum: No registered users and 5 guests