input file - change text button of data-button-text - javascript

I'm using this angular file upload (nervgh/angular-file-upload) in my angular app. It works very well and I have no problems with the uploads.
I have one problem with one button, this is the button exaple code:
<input filestyle="" type="file" data-button-text="Single"
data-class-button="btn btn-default" data-classinput="form-control inline"
nv-file-select="" uploader="form.uploader" class="form-control"/>
I would like to set data-button-text with one variable since my app has 3 different languages.
Something like this: data-button-text="form.variable-text" (or some kind of variable) instead a string like data-button-text="Single"
At the moment, I'm not able to change that text by any variable. I tried a lot of times with differents ways without any success. I can't use angular curly braces or controller variables. At least, I dont know how to do it.
Any help? Any Ideas?
Thanks.

Jorge.
I think the property you are searching is "data-buttontext" instead of "data-button-text".
Tell me on friday at the office meeting if it worked.

Related

how to sessionstorage slider value

here are my code,
`<script src="main.js"></script>
<script type="text/javascript">
wwr_start();
function onSliderChanged(slider) {
wwr_req(`SET/TRACK/${slider.id}/VOL/${slider.value}`);
<label class="drx"> Stax </label>
<input class= "raa" type=range min=0 max=3 value=1 step=any id="3" oninput="onSliderChanged(this)">
by the way, i excluded my css style code.to give you brief explanation of my code, it's volume controller for my digital audio mixer. "id" in range input represent track number of my mixer so can't really change to something else. So i would like my last slider value (the slider position) to be remained where it was even when i refresh the page. i treid to use sessionstorage but couldn't really figure out how. i googled, and researched a little of how to use, it seems like i have to use json stringfy option to store slider value to sessionstorage and load out when it's refreshed.
can anyone help me out please? i'm pretty new at coding and kind of running out of time to study from scratch
i tried to use sessionstorage but couldn't figur eout
Write into sessionStorage :
sessionStorage.slide = JSON.stringify(this.slide))
, the slide is the key you set into session storage.
Catch at local :
let final = JSON.parse(sessionStorage.slide), you can get the key from session storage, then set it as a variable final to execute the following things.
The content as mentioned above is a simple concept which not use your actual code to demonstrate, so please do not copy the code directly for your project :)

VueJS - How to apply directives to all matching tags?

I'd like to apply a directive to all input tags programmatically. Two reasons for this are:
I don't want to have to go through all inputs in my app to add the directive
If I want to change the directive against all inputs at a later date, it's in one place.
Is this possible? I've reviewed the docs but they don't seem to mention applying it in any other way than applying the tag directly to the element.
My current code is like so:
<input type="text" class="form-control input-sm" id="price" v-model="model.doc.price" v-floating-label>
I was having a brain dead moment it seems. I just need an input component. I can then change what I need on there and it will update everywhere the input component has been used and instead of using the standard html input tag, I'll use my component.
Long day ...
I've answered this question myself instead of deleting it in case anybody else has the same brain dead moment in the future ;)
As per Evan You:
Vue.js compilation happens when you instantiate/mount the root instance.
See https://github.com/vuejs/Discussion/issues/77#issuecomment-60339440
I don't think what your are trying to do is sane: search and replace, coming out of the box in many text editors or IDE, will be really helpful for your two explained reasons.
You can bind that directive to a condition like so
<input type="text"
class="form-control input-sm"
id="price"
v-model="model.doc.price"
:v-floating-label=(condition)>
If condition == true , v-model-float directive will be applied to your input.
Update 1: From the comments, the implementation will still be the same, except you control the condition from one place. That way, you can remove the directive at a later date by simply setting that condition to false.

Angularjs validation with expression

I'm trying to implement input validation by angular expression ,I need to do that because i'm going to get validation data from database.
So I'm trying the following code
conttroller
vm.key="ng-required"
vm.value="true"
html
<input type="text" name="field" ng-model="name" {{vm.key}}="{{vm.value}}" >
but this make no change.
You can't use {{}} directive to create attribute dynamically(it will not work), and I don't think so that would be correct approach to do it. I'd like to suggest slight different way to deal with such validation, like you could take use of angular inbuilt directive like ng-minlength, ng-maxlength, ng-required, etc. which does take expression as their attribute values.
like for case it would be something like
ng-required="vm.value"

How do I get the data value from a button?

I am building a forum app in node and I would like to create big bright buttons on my home page that would route users to another /view (topic) when clicked on.
I would like to gather the value of the button pushed inside of an object, so that I can use it within a dynamic route to be able to render to a specific view. I will also need that value to query with. Unfortunately I am having trouble getting the value of the button clicked.
Here are my buttons/inputs:
<form action='/topics' method="GET">
<input type="submit" value="boy" id="boy" class="bounce topics">
<button type="submit" value="girl" id="girl" class="bounce topics"><h2 class='topic'>Girl</h2></button>
</form>
when I console log req.body neither method gives me anything, I only get an empty object. I have read the two other threads I could find that were similar, but even though my code is comparable, I am getting nada.
I believe the method attribute in your form element needs to be POST instead of GET
You may use either GET or POST in the method. The difference is that you will be retrieving them from the $_GET or $_POST global variables on the server side in PHP (or similar variables in the language of your choosing).
Instead of using "id" for each input element, you must specify names:
<input type="submit" name="boy" value="boy">
<input type="submit" name="girl" value="girl">
You should be able to access URL / GET variables via req.query.<variablename>.

Click on a button with long url for name with javascript bookmarklet

I need either a javascript which can click on a button. The thing is, there are 100+ buttons on the page all with the same value. The name is unique but quite long.
The full name of the element is something like :
actions[http://apps.facebook.com/frontierville/giftaccept.php?next=giftaccept.php&senderId=1%3A1325206719&gh=3a8bfdace76051752a9127d1f9b43872&gift=nails&timestamp=1285598414&ref=tab&key=29b15e06ed9d7c00a8870c955ab938cf%24%24cfH1PUUZ%217bZYhg8M-o-XQc%218HHRMcvvyhuf4d%21.64qEvlQe&src=request&aff=gift&crt=nails&signature=6dd3fa03fe88f98b6dcab4faf4c7da94]
The value of every button is Accept and Play.
So. Is there a way to have it click on the button with a specific URL in the name?
I tried this:
javascript:(function(){var b=document.getElementsByName('actions[http://apps.facebook.com/frontierville/giftaccept.php?next=giftaccept.php&senderId=1%3A1325206719&gh=3a8bfdace76051752a9127d1f9b43872&gift=nails&timestamp=1285598414&ref=tab&key=29b15e06ed9d7c00a8870c955ab938cf%24%24cfH1PUUZ%217bZYhg8M-o-XQc%218HHRMcvvyhuf4d%21.64qEvlQe&src=request&aff=gift&crt=nails&signature=6dd3fa03fe88f98b6dcab4faf4c7da94]');for(var j=0;j<b.length;j++){if(b[j].value.match(/^Accept and Play/i)){b[j].click();break;}}})()
and it did not work. Any suggestions?
EDIT:
If it helps, here is the source of the info for one of the buttons:
<input value="Accept and Play" type="submit" name="actions[http://apps.facebook.com/onthefarm/giftaccept.php?senderId=1259413693&gift=mysterygift&timestamp=1285599906&ref=gift_accept_tab&key=78fcc7de3b36b8f9564262fab506893f%24%24ceK5RVRY61bZYhg8M-o-XQcyL%2CzHccEwEeuj4e-%21-dh0AD0A2AgyScd&signature=32db959ce43f8330cf8fd992fbd53a51&srcapp=FarmVille]">
your script works for me.
Are u sure, that you use the exact name in your script?
Are there other elements in the page, that share the same name?
If it does: you better also check the type of these elements. If they are not click()-able Elements(for example hidden-Inputs or text-inputs, this will cause an exception, so your loop will be stopped)

Categories