Followed the simple tutorial from here
Settings of Bespin embedded?
But cannot figure a way to add a 'save' button that would trigger an ajax event or whatever so i can process it and save the content to a file.
Any clues ?
What you'd want to to go here is get a handle to the text value of the editor in javascript and post that server side to save either as a file or in a db.
You can get the editor text value this way:
var editor = env.editor;
var value = editor.value;
One easy trick would be to copy that value to a hidden field so you could process it like you might any other form field.
Related
I am trying to make an application that would have a form that gets autofilled once the user uploads a JSON file and clicks the load button , so I was wondering if there's any way to achieve this .
Thanks
That's totally possible. Just make the file upload write a JSON to state (https://www.geeksforgeeks.org/file-uploading-in-react-js/) and then when the user clicks a button, scan through the uploaded JSON for the relevant keys. When you find a key, just use the value associated with it and set the state value of the associated form element.
Sommeone please tell on how to get get cursor position in lightning input rich text in lightning web component.
I am using the following code but getting undefined:
let element = this.template.querySelector("lightning-input-rich-text");
console.log(element.selectionStart, element.selectionEnd);
I wouldn't call it a complete solution.
Use "window.getSelection()" to get the selection indexes, however you might want to ensure the rich text was in focus when selection occurred.
the specified method will return a Selection object, anchorOffset & extentOffset properties will contain the start and end indexes.
Hello I have been trying to implement my app to zapier. I am able to authenticat through oauth2 and calls are going well but I am not able to pass data to back end when I use combobox.
I created two trigger
1) First trigger doesn't have trigger field, just a polling URL which fetch data from server and set variable. It works as expected. It sets data to lets say variable "X"
2) Second trigger is basicly for using "X" I have one trigger field "Y" which is combobox and as documentation I just write X.id.name and I can see combobox with field. I want to implement combobox selected event. I implement polling url like this http://mywebpage.com/myapi/{{Y}} . But whenever I test my zap , lets say I choose id = 5. it always request http://mywebpage.com/myapi/{{Y}} but not http://mywebpage.com/myapi/5 how can I solve it.
Thanks.
Ok I found the fix. I needed to change second trigger type to Unicode, because this way I can get selected one. Now is working.
I built a simple in-place editing solution for profile data in my app. The problem is, if someone edits a field and modify the text of that field but choose "cancel," instead of save, because of Angular's bindings, the text change is still displayed in the UI.
I was thinking that when someone it "edit profile," I would capture the original value of the field so that if they hit cancel, it could restore the original text.
$scope.editProfile = ->
$scope.editState = true
$scope.originalDescription = $scope.user.profile.description
Of course, something like this doesn't work. I do want to capture $scope.user.profile.description at the time that editProfile function is called.
Any suggestions for strategies here?
What you can do, is:
angular.copy($scope.user.profile.description, $scope.description.backup)
and if you need to restore the original values:
angular.copy($scope.description.backup, $scope.user.profile.description)
I'm dynamically creating some PDF files through my application, using iText, and I need to use several components (TextField, CheckBox, RadioButtons etc), and then submit the values to server. But, one of the requirements says that the user needs to be able to select and send files along with the other values. I did not find a specific component to this, and so I'm asking for some help with this situation.
Is there a way to create some kind of Input File, File Chooser, etc, and attach it on the generated PDF file? And then send this selected file to server?
Thanks
This is explained in the official documentation, more specifically in the example FdfServlet of chapter 9 of my book. However, in this example, we add a file selection field to an existing PDF, so I've made you an example that explains how to create such a field when creating a document from scratch: FileSelectionExample
A file selection field is created just like any other text field, except that you have to set a flag using the setOptions() method. If you want a file chooser to appear, you also have to add a JavaScript action:
TextField file = new TextField(writer, new Rectangle(36, 788, 559, 806), "myfile");
file.setOptions(TextField.FILE_SELECTION);
PdfFormField upload = file.getTextField();
upload.setAdditionalActions(PdfName.U, PdfAction.javaScript(
"this.getField('myfile').browseForFileToSubmit();", writer));
writer.addAnnotation(upload);
In the full example, I also added a second field and after selecting the file with the browseForFileToSubmit() method, I set the focus to that other field. I'm doing this because the file name only becomes visible in the file selection field after that field loses focus.