Tips for deactivating a form field through ajax within a commandlink located in a datatable

I'm facing an issue where I have a form capturing Contract records and displaying them in a datatable. The datatable has an "Edit" commandlink tag, which when clicked should populate the form with the contract data, but disable the Contract No field. I've implemented this disabling functionality using Ajax onEvent tag, which is working fine. However, the fields are not being populated/displayed in the form when the Ajax is used. If I remove it, everything works except that the Contract No field becomes editable. Here are my edit tags.

<h:commandLink id="editLink"  value="#{bundle.ListUnitEditLink}"   >
   <f:ajax   onevent="disablePK" listener="#{contractManager.updateContract}"  />
</h:commandLink>

This is my backing bean.

public String updateContract() {
    System.out.println("Now in UPDATECONTRACT method and serious debugging");
    current = (Contract) items.getRowData();
    this.newContractId=current.getContractid();
    this.newContractDesc=current.getContractdesc();
    this.newContractDt=current.getContractdt();
    this.newContractAmt=current.getContractamt();
    this.newContractStrtDt=current.getContractstrtdt();
    this.newExpDuration=current.getExpduration();
    this.newCtdBy=current.getCtdby();
    this.newCtdOn=current.getCtdon();
    this.lstUpdBy=current.getLstupdby();
    this.lstUpdOn=current.getLstupdon();
    return "contracts";
}

The properties in the bean are being assigned correct values, but they are not showing up in the form for editing.

Answer №1

My issue was resolved when I included render=@all in the ajax tag

 <h:commandLink id="editLink"  value="#{bundle.ListUnitEditLink}"  
                                       actionListener="#{contractManager.updateContract}">
         <f:ajax   onevent="disablePK"   render="@all"  />

 </h:commandLink>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

methods for retrieving nested JSON data from an API endpoint

My data has been exported in JSON format { "count":79, "stories":{ "23658975":{ "title":"NOMINATIVO", "description":"BUSDRAGHI PIERGIORGIO", "updated_at":"2013-06-16T18:55:56+02:00", "created_at":"2013-06-16T18:39:06+02:00", "du ...

What is the best way to track the behavior of a module function in Jest?

Currently, I am in the process of writing unit tests for a function that invokes another function within the same module. For example: export function add(a, b) { return a + b } export function showMessage(a, b) { let sum = add(a, b) return `The su ...

Double Ajax calls being made in Laravel application

I am working on a Laravel application for managing tasks. The application has a form with four fields: one for the CSRF token, two hidden fields for IDs, and an input field to capture the task title. For submitting the form, I have implemented AJAX. Howev ...

Get information from one div and implement it in a different div

I am working on an application that creates div boxes dynamically and loads images through AJAX to place inside these boxes. To avoid unnecessary loading, I want to check if a box already exists before loading images. If it does exist, then I would like t ...

Changing text inside ion-header-bar directive

When utilizing the ion-header-bar directive, I have the left side designated as class="button", the middle section containing <h1> with the word "Recent", and the right side as <ng-icon>. The text on the left side is dynamically generated usin ...

What is the solution to the error message "Cannot assign to read only property 'exports' of object '#<Object>' when attempting to add an additional function to module.exports?"

I've been struggling for the past 5 days with this issue. Despite numerous Google searches, I haven't found a solution that works for me. I have a file called utils.js which contains useful functions to assist me. However, when I include the func ...

How can one view all the static variables and methods associated with a class in Typescript or ES6?

Is it possible to retrieve all static variable names and static method names associated with a class, similar to how the Object.keys method returns a list of key names attached to an object? Typescript Example: class FindStatics { static num1:string = ...

Utilizing Three JS to add Gradient to external Models

When it comes to comparing the gradient colors applied to two spheres, the key lies in one statement: sphereGeometry = sphereGeometry.toNonIndexed(); https://i.sstatic.net/pBBs9.jpg https://i.sstatic.net/KRULV.jpg I prefer the smoother look achieved by ...

Minimize the need for frequent logins throughout the day with a Spring Boot and REST Ajax application

I recently completed a single-page web application using AngularJS and Spring Boot, following the example provided in the x-auth-security code on GitHub. While the application is functioning properly, there have been complaints from users about having to ...

A lone function making two separate calls using AJAX

I have a function that includes two Ajax Get calls. Each call has a different function for handling success. function get_power_mgt_settings() { window.mv.do_ajax_call('GET',power_mgt.get_spin_down_url{},'xml',true,show ...

Tips on choosing just the selected checkbox values

In my CodeIgniter view, I am utilizing AJAX to post data to my controller. <script type="text/javascript"> $(document).ready(function(){ // find the input fields and apply the time select to them. $('#sample1 inp ...

Guide to displaying an email template on a webpage

I am facing a challenge with rendering an email template on a web page. The email template comes with its own CSS, for example: <style> body{ font-size : 20px; } </style> However, when I attempt to display the email template on my webpage, ...

Send a line break character as a parameter to the function

I'm currently working on a function that creates a string using a specified separator passed in as an argument. When utilizing the \n character as a separator, the output doesn't match my expectation. let concatenate = function(first, secon ...

Encountered an Internal Server Error while invoking PHP script through ajax request

When I click on a specific button on the screen, my goal is to trigger an AJAX call to execute a PHP script. This script will then fetch data from an object that contains information retrieved from a MySQL database and display it in a table. Each of the in ...

Using setAttribute does not function properly with ngModel within Angular framework

I am attempting to automatically assign ngModel while creating an HTML element. Here is my code: productName.setAttribute('[(ngModel)]', `customProductName`); However, I am encountering the following error: Failed to execute 'setAttribute ...

proper integration of socket.io

I have been experimenting with socket io for my project to display online friends, and I have noticed an issue that seems strange to me. Every time the page is rerendered (whether due to a user changing their profile information or sending a friend request ...

Position the div in the center and enhance the function to dynamically adjust when the user attempts to resize the window

var windowHeight = $(window).height(); var windowWidth = $(window).width(); var scrollTop = $(window).scrollTop(); var scrollLeft = $(window).scrollLeft(); jQuery.fn.center = function () { this.css("position","absolute"); this.css("top", Math.max( ...

Instructions for transforming DOM information into a JSON format

I have multiple inputs within my document, as shown in the code snippet below. My goal is to create a string or JSON object using the input names and values. var arr= []; $('ul li input').each(function(){ let name = $(this).attr(' ...

Appending a row to a table will not trigger events in Select2

Despite several attempts, I can't seem to get the select2:select event working on dynamically added rows in a table using select2. The event only works on the original row. Unfortunately, I don't have any additional details about this issue. COD ...

Learn how to send or submit data using the Form.io form builder

I am currently working on a dynamic drag and drop form builder, and I'm struggling to figure out how to log the data from the form. Below is the component.html file where I am implementing the drag and drop form: <div> <form-builder ...