How to insert lightning component to visualforce page with apex after button click - apex

I want to insert a lightning component to a visualforce page after a button click is done in the visualforce page. So I want to do some vf-controller functions and then open a lightning component in the apex controller of the vf page.

After button click use at function but you need to create one app for it
<div id="lightning" />
<script>
$Lightning.use("c:Test", function() {
$Lightning.createComponent("c:testCMP",
"lightning",
function(cmp) {
// do some stuff
});
});
</script>
You need to create one lighting app and add dependency in it
c:Test is App and c:testCMP is component

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>

make text in form box disappear on click in webplus X5

In WebPlus, I am trying to make the text in a form for a support page disappear on click, or disappear when the box has contents inserted. How could I do this?
HTML CODE at here.
Although I'm not familiar with WebPlus, it's just HTML at the end of the day.
First we need to add an ID to your Submit Button ( assume this is the button you want to click that will hide stuff?)
<input id="Submit" type="submit" style="position:absolute; left:137px; top:668px; width:81px; height:22px;" value="Submit">
What we'll need to do next is put some javascript into your form page's HTML that hides the textbox(es) you choose.
for example:
<script type='text/javascript'>
$(window).load(function(){
$('#Submit').click(function(){ //when submit button is clicked
$("#txt_32").hide(); //hide this element
$("#txt_33").hide(); //hide this element
//etc... hide the text boxes by grabbing them with their ID tag
});
});
</script>
After that, you'll probably want to unhide them. I'm not sure what the end goal is or what you're trying to do, but to get hidden elements to show you call .show() on the elements that we called .hide().

Can I trigger a knockout viewmodel update programmatically?

I've coded a form with various value-bindings and a knockout viewmodel behind it. The form is submitted by an AJAX post (triggered by a click-binding on a form button). I've noticed that the model isn't correctly updated BEFORE the post when I make changes in a textfield, leave the cursor in it and directly click the submit button.
I'm aware of the "afterkeydown" option of the value binding, but I prefer not to use it, since it would also trigger my validation on every key strike. Is there a way to force the model update programmatically in my ajax submit function?
Try using the submit binding instead of click:
<form data-bind="submit: doSomething">
... form contents go here ...
<button type="submit">Submit</button>
</div>
<script type="text/javascript">
var viewModel = {
doSomething : function(formElement) {
// ... now do something
}
};
</script>
The documentation page on submit:
http://knockoutjs.com/documentation/submit-binding.html

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