dynamic file picker.io control doesn't work - filepicker.io

I Have Created Dynamic FilePicker Control on Button Click Event of Jquery
but the button click event of this dynamic control does not open the filepicker.io popup where files get uploaded on filepicker...
Below is the html code by which i have created this control in jquery
<input type="filepicker" data-fp-apikey="Acdgfv0GWQXyMKwqVMfMHz" data-fp-mimetypes="image/*" data-fp-container="modal" data-fp-services="COMPUTER" class="uploadImg btn border-blue-btn" tabindex="31" style="display:none"> <button type="button" class="uploadImg btn border-blue-btn">Pick File</button>

Filepicker javascript library construct widgets immediately after script is loaded. Using filepicker with any client side rendering library requires manually call
filepicker.constructWidget();
method on Dom element. You need to set element type as 'filepicker' etc.
Basic example:
var input = $('<input>').attr({
type: 'filepicker',
class:'picker',
}).appendTo(config.results);
filepicker.constructWidget(input);
And full working example:
http://jsfiddle.net/krystiangw/hfg6k8u2/

Did you include filepicker.js library?
Please try this example (link: https://jsfiddle.net/gy2gLvkw/)
<script type="text/javascript" src="//api.filepicker.io/v2/filepicker.js"></script>
<input type="filepicker" data-fp-apikey="Acdgfv0GWQXyMKwqVMfMHz" data-fp-mimetypes="image/*" data-fp-container="modal" data-fp-services="COMPUTER" class="uploadImg btn border-blue-btn" tabindex="31" style="display:none" onchange="alert(event.fpfile.url)">
I've added onchange="alert(event.fpfile.url)" to input element so that the url is displayed after upload.

Related

Event onclick dynamic

i use https://angular.io/guide/dynamic-form angular dynamic form. How is it possible to intercept the click event on every input field of the web page? I tried
<pre>
<df-question [question]="question" [form]="form" ng-
click="onContainerClick($event);"></df-question>
</pre>
Thank you
Instead of applying the click to the tag, just in your DynamicFormQuestionComponent (df-question) add click event on the input field (code taken from the docs)
HTML:
<input (click)="onContainerClick($event)" *ngSwitchCase="'textbox'"
[formControlName]="question.key"
[id]="question.key" [type]="question.type">
BTW, you were using ng-click which is not Angular, but AngularJS.
TS:
onContainerClick(event) {
console.log('clicked')
}
DEMO (check console) https://plnkr.co/edit/MbwuhWJrJOwuW23ZbzsC?p=preview

How to goto back page on click of cancel button in ZUL apge

I wanted to navigate to the browsers back page (History) onclick of Back button. How I can achieve this usign zul page? I have one option of keeping the hidden field and redirect via composer or using zk's if condition. But any other solution like javascripts function are?
You can use client side javascript in combination with Java Script's history object:
<zk xmlns="http://www.zkoss.org/2005/zul">
<div>
<button label='back'
xmlns:w="client"
w:onClick="history.back();"
/>
</div>
</zk>

Button Onclick does not work inside form

Good Day
I am using an ASP.NET webform where I have wrapped the following button inside the form tags:
<form runat="server">
<button class="btn btn-primary" onclick="window.location='http://google.co.za';">Login</button>
</form>
ISSUE: The problem is that when clicking on the button, it just directs to the current page...does not redirect. However, when I remove the form tags, the button works. If I leave the form tags and I use an anchor tag to relocate, it works as well...It is just the button that is giving me issues.
Why is that?
I am using Twitter bootstrap as well(extra info..)
Thank you
Add type="button" attribute to your button tag. Without it button works as submit.

How to show a cq5 form page in a overlay

I have the code below to show a button in a overlay.
<div class="overlay22" id="overlay22" style="display:none;"></div>
<div class="box22" id="box22">
<input type="submit" value="Submit" class="buttonclick" id="buttonclick" />
</div>
Can we show the cq5 form in the overlay instead of hardcoding in the overlay?
If you are just creating some sort of basic form template or component, I think you should just stick to using regular HTML elements and then control look + feel with CSS. Though if you absolutely needed to use form elements similar to what you see in CQ's dialog windows, you will need to generate them by working with CQ's extension of the Ext JS framework.
For example, if you wanted to create a button analogous to your provided example, you'd have to write something like:
CQ.Ext.onReady( function(){
var button = new CQ.Ext.Button({
text : "Submit",
id : "buttonclick",
cls : "buttonclick",
renderTo : CQ.Ext.getBody(),
listerners : {
click : function(){
// Write handler code here
}
}
});
});
Widget API for latest version of CQ (5.5):
http://dev.day.com/docs/en/cq/current/widgets-api/index.html
Materials on Sencha Ext JS 3.4 (which I believe 5.5 is built on):
http://docs.sencha.com/ext-js/3-4/
We can do in the following way as well,
Say for instance we have a page with default cq5 form component already dragged in that,
Let that page be defined in this path as /content/geometrix/loginpage.html
Now we can show the above page in an overlay, using the below code
<div class="overlay22" id="overlay22" style="display:none;"></div>
<div class="box22" id="box22">
<sling:include path="content/geometrix/loginpage/par" />
</div>
Below that par we can find the contents of the form.Here box22 is the lightbox(pop up) and the overlay22 is the background div

Forms in Webkit HTML Notifications?

Is it possible to use form elements in Webkit HTML desktop notifications? I'm tried to open a HTML notification from a Chrome extension, and the <input> I added appears, but I cannot type in it. I'd like to be able to capture the input from it and save it.
var notification = webkitNotifications.createHTMLNotification(chrome.extension.getURL('input-prompt.html'));
notification.show();
<html>
<body>
<form><input type="text" name="here" value="test" /></form>
</body>
</html>
You can get around this in a pretty simple way. You can create a div that serves as your input box, and allow the content of the div to be edited (look here). Then you can use a button or another div as the submit button, then handle the form submit with javascript.
<div contenteditable="true" id="inputBox"></div>
<div id="submitButton" onclick="submitform();">Submit</div>
While I agree that desktop notifications are probably not meant to contain forms, I have a case where having a form in the notification is actually more convenient. I hope this helps.
Notifications are not meant for interactivity. They are meant to notify.
If you want to have interactivity, use an Action instead.