How to set the value of combobox programmatically?

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

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

How to set the value of combobox programmatically?

#1

Postby t4nu » Fri Feb 12, 2016 7:21 am

Hi,
I have a component with display type as combobox, and now I have the need to set the value of it programmatically, as far as I've tried, even when I set the value in the script the display keep show me "Please Select" text. The same thing happen to the radio button.

So as the subject stated, how to do it?
Thanks in advance for the help.

Edit:
Maybe it would be more clearer if I describe what the form is look like.
The form is consist of several pages, and on each page there are several combos display type and radio button.

I change the field content using code something like this:

fields.FIELDNAME.value = <new>
0 x

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

#2

Postby Jon » Fri Feb 12, 2016 9:47 am

Make sure that the value you are setting for the field exists in the list associated with the field.
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#3

Postby t4nu » Mon Feb 15, 2016 5:30 am

It is definitely exists.
Jon wrote:Make sure that the value you are setting for the field exists in the list associated with the field.
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#4

Postby t4nu » Thu Feb 18, 2016 4:30 pm

Still cannot make this work :(
The value is exists in the list (in fact, the value set is taken from the list previously).
Any other way to solved this? Or maybe the way to debug it to know what the problem is? I tried using log(), everything seems ok, the problem is that the display is not changed.
Jon wrote:Make sure that the value you are setting for the field exists in the list associated with the field.
0 x

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

#5

Postby Jon » Thu Feb 18, 2016 6:10 pm

Check you don't display the same field twice on the same page. If you do this, the value of the last occurrence will be set on the server. Other than that, you might try removing the list and see if the problem goes away i.e. is the problem caused by the list or is it something else?
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#6

Postby t4nu » Sun Feb 21, 2016 7:24 am

The same field on the same page? No, there is only one.

I tried to debug it by adding the button to the page, when the button clicked it will set the value of the list (I set it with A and I make sure it is exists on the list).
Still when I click the button, nothing happen, the list display is not change at all.

The other field that can be changed from within the script is of the type of textbox or date, the radio button and drop down cannot be changed.

Any other thing that should be tried?

Thanks for the help.
Jon wrote:Check you don't display the same field twice on the same page. If you do this, the value of the last occurrence will be set on the server. Other than that, you might try removing the list and see if the problem goes away i.e. is the problem caused by the list or is it something else?
0 x

kotinkarwak
Ebase User
Posts: 109
Joined: Mon Sep 21, 2015 9:55 pm

#7

Postby kotinkarwak » Sun Feb 21, 2016 8:36 am

Please find sample file

https://mega.nz/#!jVxQRI5C!Usc9jBEDfCTT ... 9Q0vF4qSJ4

Here, I have a static list that will populate the drop down control and a button to get and to set the value.
0 x
ebasetech v5

Skype: mateso08
Location: Kenya

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#8

Postby t4nu » Sun Feb 21, 2016 9:23 am

Sorry for a dummy question, but now
I got the files, then what should I do with those files?
I try to import but nothing added tot the designer.
kotinkarwak wrote:Please find sample file

https://mega.nz/#!jVxQRI5C!Usc9jBEDfCTT ... 9Q0vF4qSJ4

Here, I have a static list that will populate the drop down control and a button to get and to set the value.
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#9

Postby t4nu » Mon Feb 22, 2016 6:47 am

1. If I set the value for the dropdown type (dynamic list) before the list is build, will the value be changed or revert back to null after the list is build?

2. Is every dynamic list has to have a database resource?
0 x

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

#10

Postby Jon » Mon Feb 22, 2016 12:36 pm

If I set the value for the dropdown type (dynamic list) before the list is build, will the value be changed or revert back to null after the list is build?
No, so long as the value you set exists in the list.
Is every dynamic list has to have a database resource?
A dynamic list doesn't use a database resource. They are two different things. You can use a database resource to create a dynamic list, but that's the end of the connection.
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#11

Postby t4nu » Mon Feb 22, 2016 10:42 pm

Thank you for the info.
Jon wrote:
If I set the value for the dropdown type (dynamic list) before the list is build, will the value be changed or revert back to null after the list is build?
No, so long as the value you set exists in the list.
Is every dynamic list has to have a database resource?
A dynamic list doesn't use a database resource. They are two different things. You can use a database resource to create a dynamic list, but that's the end of the connection.
0 x


Who is online

Users browsing this forum: No registered users and 8 guests