change outpufield value dynamiclly

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
aa73
New User
Posts: 19
Joined: Fri Aug 23, 2019 5:13 am
First Name: Alexis
Last Name: ALABERT
Company Name: LOISELET & DAIGREMONT
Country: France
Contact:

change outpufield value dynamiclly

Post by aa73 »

Hello,

I want to know if it's possible to change dynamiclly the value of a output field?

For example, the zip code.
Imagine you have two field
- the first a textbox with "database-driven auto-complete" to chose a zip code
- the second a output field to display the town

When you choose a zip code, you display the town.

thanks for your help.

Regards
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: change outpufield value dynamiclly

Post by Scott Klement »

You can an output field from JavaScript by calling the pui.set() API
https://docs.profoundlogic.com/x/HIAFAQ

Be careful with showing the town for a zip code, as zip codes do not always correspond directly to a town. For example, sometimes there are several towns that share a zip code. Or, conversely, sometimes there are larger cities that have many zip codes.
aa73
New User
Posts: 19
Joined: Fri Aug 23, 2019 5:13 am
First Name: Alexis
Last Name: ALABERT
Company Name: LOISELET & DAIGREMONT
Country: France
Contact:

Re: change outpufield value dynamiclly

Post by aa73 »

Hello,

Thanks for the advice of choosing the city instead of the zip code.
I watched the instruction "pui.set ()".

The problem is that I still do not know how to get the information in the database.

Let me explain: when the user will enter the name of the city in a textbox field, how can I do to retrieve the associated zip code to display it in his field?


If I put this script : the variable "res" contains the name of the city, not the zip code :

var res = get("TextBox1");
console.log(res);
pui.set ("OutputField3", res);



the variable "res" contains the name of the city, not the zip code.


Thanks

Regards
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: change outpufield value dynamiclly

Post by Scott Klement »

So the user is going to type a complete address and you want to fill-in the zip code (postal code) that corresponds to that address?

The traditional way to do that is for the user to key in the information and press enter. The screen will then go back to the server-side program that is driving the screen (RPG, Node.js or whichever server-side language you are using.) The server side program would look up the postal code, put it in the field, and re-display the screen.

If you would prefer to do this without submitting the screen, you could do it with an AJAX request. When the user changes the field, you call the JavaScript ajaxJSON() API (or similar) and it sends the typed data to a server-side AJAX program, such as a Universal Display (Universal is just one way, there are many ways to code this) that program would look up the postal code and return it, and then your Javascript code could use pui.set() to set the field on the screen. This would happen asynchronously in the background while the user is still using the screen, no need to submit it.

I guess you could try to code using a database driven widget, too... that seems to be what you're attempting? This would probably work, but I must admit that I've never done it that way before. Maybe someone else here has done it and can reply?
Larisabrownb
New User
Posts: 1
Joined: Sat Apr 08, 2023 5:17 am
First Name: Larisa
Last Name: brownb
Company Name: love language test
Address 1: USA
Address 2: USA
City: USA
State / Province: West Virginia
Zip / Postal Code: 45654
Country: Virgin Islands, British
Location: USA
Contact:

Re: change outpufield value dynamiclly

Post by Larisabrownb »

One way to do that is at the beginning of the Transformation 2 pipeline use a select values to filter our any fields you don't need. That will ... - Multi-Field Formula has an option to "Change Output Type to" to set the new field type of the dynamically selected fields.Just change and use var.first . Again that's because this is a functional component. If it was love language test class components it would be this.first . So how ... Hi Constantin Mitide, <apex:outputfield> is used to display different kind of fields in According to their type, We can't use static text as ...I have a Visualforce page on which I am rendering a lot of fields using a Dynamic Component (which is an Output Panel that contains all of the ...You could use an onclick event handler in order to get the input value for the text field. Make sure you give the field an unique id attribute so you can refer to it safely through document. getElementById() : If you want to dynamically add elements, you should have a container where to place them.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests