Prevent default (showing file dialog) on form file input in Bootstrap-Vue - bootstrap-vue

I'm trying to override the default file browser dialog with a custom function when the user clicks on the file selection dialog as shown below in Bootstrap-Vue.
The code is
<b-form-file
v-on:click.prevent
v-model="file"
:state="Boolean(file)"
placeholder="Choose a file or drop it here..."
drop-placeholder="Drop file here..."
></b-form-file>
I tried adding v-on:click.prevent, and #click="function (e) {e.preventdefault()}" but those don't work for me.
https://bootstrap-vue.js.org/docs/components/form-file/

The way to prevent the default file browser from showing (and to run your own action on click) would be something similar to the following:
<b-form-file #click.native.prevent="alert('Hello world')"></b-form-file>

Related

Bigcommerce Checkout page edit

I am using Valult theme in bigcommerce and want to edit checkout page because i want to rename the a button. I went through all the files but there was no html check i found a tag {{{ checkout.checkout_content }}} in checkout page which is rending that part containing button. There is no file with contains the tag html. This content is rendered in Inspect element but when i view the source of page the content is not present there.
I tried to change the name of button with JS/JQ but it is not working because that Tag part wont comes in Source file but somehow it is present in inspect element.
How can it edit the Button name now ?
The checkout content is rendered with React.js. The only way to edit the template would be to build a custom checkout. This is probably a bit overkill here. To simply edit the text of a button, you have a few options. However, the simplest would be to just add the translation key to your en.json lang file and change the value to the desired text.
In your theme files, navigate to en.json. Find the end of this file, and right before the last closing brace, add in the optimized_checkout key, along with any values you need. For example, if I wanted to change the "Continue with PayPal" button text to be "Continue", I would replace the last two lines of en.json with the following:
},
"optimized_checkout": {
"payment": {
"paypal_continue_action": "Continue"
}
}
}
There is more information on how to do this here: https://developer.bigcommerce.com/stencil-docs/localization/multi-language-checkout
And here is the reference for the optimized checkout keys to use: https://github.com/bigcommerce/checkout-js/blob/master/src/app/locale/translations/en.json

File upload test using Katalon when the 'browse' button isn't an input element

I want to test a file upload but as opposed to the How to Handle File Uploads tutorial, the 'Browse' button in my case isn't an Input element.
I've attached a pic of the HTML script of the 'Browse' button:
html_script_img
and this is how it looks on the website:
webpage_img
How can I test a file upload in this case without dealing with the 'Open' explorer window?
Thanks.
There isn't any input fields in your code, so you can't use sendKeys() method. There isn't any field to receive it. You should click on browse button and handle file upload dialog with an AutoIT script or java.awt.Robot class.

can't reopen featherlight div after closing it

I've started using FeatherLight and have a small problem:
I have a simple div. Here is its code:
<div id="AddNewItemToMenu" style="display:none;">....</div>
Basically i can open the lightbox and it is shown perfectly and everything is ok - UNTIL i manually force a close of the lightbox popup via Javascript.
After closing it once? - when i try to reload it again, i get an empty lightbox (maybe the close operation erased the div's content).
For the close command i use:
$.featherlight.close();
and for the opening command (opening of the featherlight lightbox) i use the following command:
$.featherlight($('#AddNewItemToMenu'), { 'persist' : true });
Any ideas why that happens?.
Maybe there is another methood of hiding instead of closing? (something that won't vanish my div?).
Thank you!.
Updated:
I've attached an example file. Uploaded to some temp site. here is the link: https://ufile.io/wxipg
When opening index.html => click on the "Open Featherlight" and then close the popup and then click on the "Open Featherlight" again, and you'll see empty div.
You should either use featherlight's binding (e.g. $('#open-fl').featherlight(...)), or else use the result of $.featherlight to re-open it, e.g.:
var fl = $.featherlight(...); // Opens dialog a first time
fl.close(); // Closing it via JS
fl.open(); // Opening again

nyroModal v2: How to validate form opened in iframe?

I'm trying to figure out how to validate a form opened using nyroModal.
The page is being opened as below on click of a button:
$(function() {
$('.btnedit').click(function() {
$.nmManual('form_page.php);
});
});
On the form that opens up, I have a few fields that are mandatory and a cancel & submit button.
<a class="nyroModalClose button" href="#" id="btn_submit">Submit</a>
On clicking of the submit button, I want to make sure the mandatory fields have value. If no, an error message should be displayed & the modal window should not close.
I'm trying to use the jquery validation plugin, but without success. The modal window always closes irrespective of the validation scripts.
I haven't found much info regarding form validation in a modal window. Is this not a preferred approach?
Thanks in advance.
I'm not able to help you about the jquery validation plugin in a modal window, but I know that using the instruction $.nmManual in that way, the form will not be placed inside the iframe tag, and if I remember correctly the content of new page will be added without header and body tags, so in a word incorrectly. I guess this can produce no validation.
To successfully open an iframe you need to use filters as described here:
Open iframe manually in nyroModal?
I hope this can help you.

Access VBA: Form command button to do something/call function

I have created a basic form in access that has a couple of buttons and text fields.
I want the button to do something along the lines of when I click it, it should bring up a browse file dialog and when I select a file, change the text field to the path of the file.
My question is how can I program this? Specifically, do I create a module that goes like?
sub command1_onClick()
..bla bla...
end sub
Or are forms programmed differently? How can I tie a function to a button?
You can add actions to the button. In the properties window of the button is an Event-Tab. Click on On Click and select Event Procedure. You are then taken to the VBA Editor (ALT+F11) into following procedure:
Private Sub Command1_Click()
End Sub
In that procedure, you can use an API call to open the standard file dialog:
API: Call the standard Windows File Open/Save dialog box
The TestIt function in above link shows you hove to open the dialog and get the path. You can set your textbox to that path like this:
Me!Text1 = strPath
strPath has to be populated with the path you get from the file dialog.
You will want to look at the file dialog property.
Dim fDialog As Office.FileDialog
MSDN File Dialog
The above shows an example that is performed on a button click
The example adds the selected file to a listbox, for your situation you would want to use a simple textbox instead of the listbox.
You may want to set AllowMultiSelect to false to ignore the looping part if you only want one item. (this would simplify the code in the example for you.
.AllowMultiSelect = false
I may be a lil rusty but then you would want to do something like this(someone edit or correct me if I am way off)
Assuming you used varFile
(Dim varFile As Variant)
Me.TextBox1.Text = varFile
EDIT: After encountering error
It seems the error can come froma few things. Check to make sure the reference is there.
Also you may need to add the Microsoft DAO 3.6 Object Library reference.
See the "More information" section of this Link (Hopefully 2002 is close enough to 2003)
. It may have a few more helpful tips if that doesn't solve the problem.