Update fields based on selection of other fields

18 Sep '14, 06:00 PM
17,812 Views
Forum Forum Starter - Level 1

Hi,

How do I update fields in a form based on the selection of a particular field ?

Att,

Gilvan.

 
x 0
Follow
Answer Answer at this question and get points!
Forum Hero - Level 9

Hi Gilvan,

   You can review this request in the forum http://www.webratio.com/forum/question-details/ajax-on-change-selection-field-and-modify-units?link=oln15x.redirect&nav=45

 
x 0
Forum Starter - Level 3

Hi Gilvan,
in short, suppose you have a Student entity with attributes Id, Name, Email. In a form, suppose you want that when the user types the student Id, then the fields Name and Email are automatically filled with the database content.
To do so, define the Student entity with those fields, define a page, and define inside the page a form unit with fields Id as the entity key, Name (make it Preloaded and not Modifiable) and Email (make it Preloaded and not Modifiable). Don't forget to set Landmark checkbox, for your test.
Outside the page, add a selector unit upon the Student entity, name it StudentDetails, and add a KeyCondition.
Now, add a flow from the Student form to the StudentDetails selector, and name it searchDetails. Open the binding form, and bind the field Id to the Key Condition. Then add an OK Flow from the StudentDetails selector to the Student form, and bind name and email.
Finally, click the Id field of the form, in the Outline view, and in the Ajax tab in its Property view check Enable Event, keep On Change() as the Event Type, choose searchDetails as the Event Flow. Optionally, check Event Indicator.
With some external tool, insert some record in your Student table of your DB.
Generate and run your project. When you type a student Id and you click outside the field (i.e., you fire the onChange() event), name and email are retrieved from the DB.

As a different choice, you may want to make the Id field ad a selection field (instead of a field) preloaded with Id's from the database; the rest is exactly the same. To do so, right-click the oid field, choose Refactor to a selection field. Inside the page, add a selector unit upon the Student entity. Add a flow from the selector and the form, and bind the Id from the selector to the one from the form.
Generate and run. Now student Ids cannot be typed, but can be chosen from a list. Choose one, and the corresponding name and email are loaded in their fields.

 
x 0
Answer at this question and get points!

Related questions

Ajax and FCK Editor (WebRatio 5.x) ajax and javascript AJAX events problem to external JavaScript Ajax is not working in own style project Ajax link success callback? Ajax onchange and jQuery 2.x (with migrate plugin) incompatible Ajax on change selection field and modify units Ajax web app with javascript history object using the WebRatio Autocomplete template Automatic date in form Automatic file upload BPMN: URL field ckeditor - change directory for the browser Clean a form Como abrir una ventana en ajax desde una master page Como crear cambio de contraseƱa Como tener dos botones juntos en un formulario independientes de una accion? Como usar la funciĆ³n autocomplete en un field Compare with the current time coupled mandatory fields Cryptic error when submitting a form Custom Unit and AJAX / SOAP Disabilitare campi durante evento AJAX Drop down menu question Dudas sobre modelado(Data Flow,Forms y Operation Create) Dynamic attribute/field names. Possible? Dynamic instantiation of fields on a page for any Class type Empty record mistakenly saved entry form logic. Entry Unit - Default field timestamp Entry Unity, Field Date Type Error Field as link soruce Form element Form template forward/backward navigation and bookmark in ajax web app Generation errors on ajax enabled page with many components, ajax links and selective refresh Getting the absolute path of a RTXBLOBData Hide form until a flow is triggered Hiding form components based on page conditions Hierarchy component How I can receive the primary key value after adding into database from OK Port. How to add an image in a modal/pop-up window? How to get a wr:AjaxURL tag working How to keep current page/block of List/Hierarchy (Index) components after ajax link clickwith selective refresh? How to localize AJAX waiting dialog? How to open a window ajax in a BPM activity? How to redirect to the correct site view after a successful login attempt How to use LandmarkMenu as AJAX navigation how to use the landmark menu as AJAX navigation input mask javascript history object Multi Entry Unit: How to forward only checked rows? Multi-Image Upload Multiple forms on one page. HTML5 input attributes. Possible? (2 questions) multi selections field problem Multi Selects didn't work in update page Prelevare la chiave del record da una Selection Field in una Multiple Form Problem saving multi selection from input Problem with application runnung Progress bar when uploading big file(s) in a form? Pulire URL Redirecting users to another site view Resize fields Scroll ajax problem Search by Selector component does not work selection fields on cascade Select multiple files for upload Selezione sul giorno "Events Planning" Setting Upload directory Showing items that have a relation with an entity Slot in Selection Field Updating attributes of an entity upload file and the move it to other location upload file html Uppercase Uso de la componente chart de webRatio Validacion validation fields Value Length (Min) fails to validate when field is empty? WebRation - Create Navigation diagram What are the new features of WebRatio 6.1? which of these three models is closer to webratio/ifml way of creating web applications wr-ajaxDivs break layout on ajax pages.