But, I don’t like the idea of showing 2 Buttons to the user; one for choosing the file and one to perform the actual upload process. I would like to show just one button to do the whole thing.
So this is my idea, if I just could HIDE the “Choose File” button and TRIGGER IT from my “Execute Upload” button script, and somehow wait for the user to select the file to be uploaded, I technically could solve this problem.
However, in order to do that, I would need to simulate a CLICK()
Something like this:
export function ExecuteUpload_click() {
//TRIGGER THE “CHOOSE FILE BUTTON” FROM HERE
$w(“#ChooseFile”).trigger(“click”) or $w(“#ChooseFile”).click();
//WAIT RIGHT HERE FOR THE “CHOOSE FILE BUTTON” TO COMPLETE ITS JOB
//AND FINALLY PERFORM THE ACTUAL UPLOAD
if ($w(“#ChooseFile”).value.length > 0) {
$w(“#ChooseFile”).startUpload()
});
}
By the time I finished this post, I realized that I also could have only the “ChooseFile” button and perform the upload process from its own OnChange() Event. (just one button).
Any how, I would love to hear ideas and also about the Click() simulation.
Hi Luigi,
Another option is hiding on load the " Upload File " button (you can do that using the property panel of the button) and show it on the onChange event.
Hi Tal. How are you?
Tal, I have a drop down list of items. The user clicks on one of them and that Item is now sent and displayed in a user input field on my form. (perfect), However It is not saved when I submit. If I type the exact same value in the User Input field then it is saved when I submit the form. It seems that there is a difference between sending the string value of a drop down list item to the Input field and typing it in. Why is this please.
and what should I do to rectify the issue. Is it just writing a click event or something after the dropdown choice, or on change in the input field, or something else I should be doing…???
Thanks in advance for any help you can give.
@giri-zano
Thanks for the quick reply Giri.
I have tried the code from the example but its not the way I wish to save my form I want to use a submit button to save all input elements at one go. not individually through code.
for the particular area I need help with is.:
export function dropdown2_change(event) {
//Place chosen element from dropdown list into input17
$w(“#input17”).value = $w(“#dropdown2”).value; // This works fine and is displayed in input17 input box
}
As I iterated above in my post to Tal, Typing text into input17 and submitting it works via the use of the SUBMIT Button works just fine.
sending the same text to input17 from a dropdown list displays in input17 but does not save when I submit the form. This is very strange and I can find no documentation on it. I understand the concept of setfieldvalue to dataset and its uses but that is not my issue, its why displayed text in an input element which is attached to the dataset will not be saved with a submit click and every thing else is?
cheers Giri any help is always appreciated
Gary
@soylow
" I want to use a submit button to save all input elements at one go. not individually through code. "
You can´t. The standard submit button allows no other intervention. Just turn the Submit button into a normal, standard button, define an onClick event in properties, and in code for the onClick, do the setFieldValue and then a .save() of the dataset. It´ll work, we all do it.