How can I get the value from Elementor Widget control field - javascript

I'm working on an Elementor custom widget with basic fields for text. I need to grab the value of one field only in order to process an ajax request that will then populate the rest of the fields. I'm using JavaScript mutations to do so. The problem I am having in the admin editor is that the nodes do not show the values in the dom, only the placeholder content. Is there a way to enable this in the editor or do I need to go a different route to capture user input?

Related

How can make I fields mandatory during Formio editing?

I'm building a form editing page using the Formio editor and renderer.
I'd like to make specific form fields mandatory in the form editor. [different than making the field entry mandatory during submission]
There are two roles in the application -
Editor - Modifies the formio definition.
User - Submits the form data.
I'm specifically interested in making several 'meta-data' fields mandatory for the Editor. The Editor should not be able to remove certain fields from the formio component list.
A couple options I'm considering for implementation -
When the form is saved, inspect the form components and ensure the mandatory fields exist, and if they dont, create them.
Set a flag in the UI for specific components so they are 'disabled' and cannot be removed in the formio editor.
Has anyone implemented this?
You seem to be going in the right direction.
You can definitely do (as you suggested):
When the form is saved, inspect the form components and ensure the mandatory fields exist, and if they dont, create them or throw an error
Along with this, you can also extend the form builder and remove the "remove" icon that appears in the builder next to these mandatory components.
To do this,
Add a custom property to all the components, something like "customIsMandatory"
Modify the options.templates of the WebformBuilder to show a different template (one with "remove" icon removed) if the "customIsMandatory" is true for this component.
You can pre-populate these mandatory components in the builder and make sure that this property is set to true for them.

Control Text Box control's Text in D365

I have a requirement in Dynamics 365 online to control the behavior of a multiline textbox which stores call script messages.
There is a drop-down list on the form which populates the call script messages on to the text box when the user selects some options.
User can then edit these populated messages in the text box. Later if the user decides to remove some options or add some options from the drop-down, the respective messages should be deleted from the textbox.
I know this can be accomplished using html by tagging each text related to the option in the rich text box but not sure how this can be accomplished in D365 in a supported way?
Can it be done using some scripting or can it be done using web resource embedded on the form.
You can achieve this way. Source field is dropdown, destination field is multiline textbox where content has to be populated based on option selected in dropdown.
This can be done by having some placeholder markers & replace the dynamic text. But this is too complex to maintain
Just furnish this using onChange script of dropdown, you can have some configuration entity to store the pre-defined text for each dropdown option, just pull the respective content on the change of dropdown option & concatenate/replace the content of multiline with retrieved configuration text

How do you extract variables from javascript for html web form

Okay I have seen script which I got from this site Adding input elements dynamically to form
I have made some slight changes to it. The objective of the script is to ask a user for an input and then supply them with number of fields. Assume the person puts in 3. I would then want to capture those three inputs as a list and export them to python. I am currently using cgi-bin and python. Those are parameters I have to work with.
How can I pull the elements from the web form using that script
Once I activate the addfileds function. I am unable to see fields in the form below it. I would like to have more than one dynamic fields.

jsf form. lookup up primary key in popup form to be entered in parent form

I have a Java EE JSF/Primeface app with an entry form for adding/editing an entity. Let's call it Product On that form is a field to specify the Salesperson, which would really be the Salesperson's Employee Number. But most data entry users don't know the salespersons employee number off the top of their head.
I'm looking for a way to either click open a popup window where the user can put in a keyword or two, find the right B.Smith, J.Doe, etc..., click their name and have that appropriate employee number pop into the text box on the parent form.
Or somehow do this inline in the parent form where the user starts typing any keyword and ajax queries the employee database, appropriate salesperson is selected and the employee number replaces the keywords typed in the input text box.
A nicety is to have (in an non-editable state) next to the text inputbox with the employee number, the salesperson's full name corresponding to the employee number.
Or some variant of those.
I had this working in a JSP application using some hacked together javascript, but I'm having trouble porting the functionality to JSF/Primefaces and was wondering if this functionality is already available in either technology. I've been searching for a solution for a while.
One of the biggest issues if I continue to use my old javascript is knowing the the parent forms textbox id to know where to pop the value in. Using JSF form I'm getting things like j_idt28:j_idt29
You should not need to mess around with Javascript for that case, so you won't need to know the generated ids.
Since you use PrimeFaces, you may want to look into the Autocomplete component.
Besides that, you can always make use of the f:ajax tag to respond to user input and update fields according to it for example.

Changing database values in an HTML table

I have written a control panel for managing devices, however as we have imported hundreds of them, there are a lot of values that need to be manually set. I have an overview page that shows the most import information and I am looking at some way to allow the end-user to change those values by clicking them.
Right now they are just text in TD cells pulled from the Database. Would it be possible to do something like double clicking the cell changes it to a drop-down box of options and then when deselected it automatically saves it to the database?
I have been searching Google and Stack Overflow but I am not even sure what to search for to get an idea of how to accomplish this.
To do this you must (short version):
Handle click event on your value from table
Change(hide text and display input) text for input with setted value
Handle blur event on your input
If some changes have been made, send Request (by AJAX) to your php actions which save value in database. Or do nothing if there were no changes.
Change(hide input and display text ) input to text

Categories