hidden field does not have value captured.

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: Jon, Steve, Ian, Dave

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

hidden field does not have value captured.

#1

Postby xren » Mon Mar 18, 2013 2:02 pm

Hi,

I have field1 for user input, then another field2 with value set by javascript when user input to the field1. Then values will be saved to DB.

When field2 is not hidden and 'editor' is displayed, then all values are saved to DB ok.

However, when field2 is hidden or when the 'editor' is not displayed, then its value is not captured.

Is this a bug or how this can be done?

Thanks,
Xiaoli
0 x

Steve
Moderator
Moderator
Posts: 423
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#2

Postby Steve » Mon Mar 18, 2013 3:23 pm

Hi Xiaoli,

I just tested this in my version of 4.4 and everything appears to work as expected.

I have three fields mapped to a resource. F1, F2, F3.

F1 and F3 are enterable fields on the form. F2 is hidden or display only.

script:

Code: Select all


fields.F2.value = 'TEST';
resources.MY_RESOURCE.insert();
Could you be doing a fetch before the insert/update and clearing the field by mistake?

Steve
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#3

Postby xren » Mon Mar 18, 2013 6:30 pm

Hi Steve,

Sorry that I did not make it clear.

The setting value is not server side script. It is client side javascript.

Xiaoli
0 x

User avatar
jig
Ebase User
Posts: 30
Joined: Sun Oct 09, 2011 10:16 am
Location: UK

#4

Postby jig » Mon Mar 18, 2013 6:50 pm

Hi Xiaoli,

Make sure that 'field2' is not set as hidden in Ebase. If it is, then Ebase will not include 'field2' in the HTML and hence JavaScript won't find it. To get around this, you can always use CSS to hide 'field2' in UI.

Hope this helps!

Regards
Jignesh
0 x
Regards,
Jignesh

Jignesh Vaducha, MSc, MCA
Mobile: +44 (0) 77 325 47 112
Telephone: +44 (0) 1462 488 311
Email: [email protected]

User avatar
Wai
Moderator
Moderator
Posts: 165
Joined: Wed Sep 12, 2007 9:04 am
Location: Sandy, UK
Contact:

#5

Postby Wai » Tue Mar 19, 2013 8:40 am

Yep, use CSS to hide the field on the page:

For example:

display: none

This can be applied to a panel that contains your hidden fields for example.
0 x

xren
Ebase User
Posts: 272
Joined: Fri Dec 14, 2012 2:55 pm
Location: Ottawa

#6

Postby xren » Tue Mar 19, 2013 1:52 pm

Thank you both for the tips.

Xiaoli
0 x


Who is online

Users browsing this forum: No registered users and 50 guests