I am using the PrimeNG dialog component and I have a modal dialog from which, on the click of a button, I want to show another modal dialog.
What is happening is that my second modal dialog is not really modal, because I only see the content of the dialog following the button.
I do change [appendTo] attribute of the p-dialog for the second modal dialog but it does not seem to work properly.
How can I open nested dialog in a p-dialog?
Dialog in a angular 2 component:
<p-dialog header="Create/Edit Financial Flow" [visible]="display$ | async" modal="modal" width="500" height="600" responsive="true" [resizable]="false" [closable]="false">
<financial-flowdialog #myfinancialflowdialog (onCloseDialog) ="closeDialog()" [flowdata]="selectedFlows$ | async"></financial-flowdialog>
</p-dialog>
When clicking a button within the first modal dialog, should open a second dialog. Below the definition of the nested dialog:
<p-dialog header="Title" [(visible)]="display" [appendTo]="body" *ngIf="display" modal="modal" width="500" height="600" responsive="true"
[resizable]="false" [closable]="false">
<div class="container-fluid">
<form (ngSubmit)="onSubmit()">
<div class="pull-right top-buffer ">
<button type="button" class="btn btn-primary" (click)="closeDialog()">Cancel</button>
<button type="submit" class="btn btn-primary">Select</button>
</div>
</form>
</div>
</p-dialog>
<button type="button" #mybtn [value]="value" ngDefaultControl [formControlName]="key" [id]="key" [ngStyle]="style" (click)="openDialog()">{{label}}</button>
I can open the first dialog but when I click on the button to open the second dialog, the content of dialog shows up like a normal div. Below the html rendered:
<section>
<div id="nestediag" ng-reflect-form="[object Object]" class="ng-pristine ng-invalid ng-touched">
<!--template bindings={
"ng-reflect-ng-if": "true"
}--><p-dialog header="Title" height="600" modal="modal" responsive="true" width="500" ng-reflect-visible="true">
<div class="container-fluid">
<form class="ng-untouched ng-pristine ng-valid">
<div class="pull-right top-buffer ">
<button class="btn btn-primary" type="button">Cancel</button>
<button class="btn btn-primary" type="submit">Select</button>
</div>
</form>
</div>
</p-dialog>
<button ngdefaultcontrol="" type="button" value="Select a payee" ng-reflect-name="flowpayee" ng-reflect-ng-style="[object Object]" ng-reflect-value="Select a payee" ng-reflect-id="flowpayee" id="flowpayee" class="ng-pristine ng-valid ng-touched" style="width: 100%;">Select a payee</button>
</div>
</section>
You can solve this problem by appending the second dialog to the document body by using the appendTo attribute, e.g.
<p-dialog appendTo="body">
...
</p-dialog>
Defining a componentref variable and using [appendTo]="Componentref" solve the issue.
See discussion https://github.com/primefaces/primeng/issues/656
You can solve this problem by appending the second dialog to the document body by using the appendTo attribute, for e.g.
<p-dialog appendTo="body">
.............
</p-dialog>
Related
<div class="modal-footer">
<button class="btn cancel-red" type="button" ng-click="cancel()">Cancel</button>
<button class="btn confirm-blue" type="button" disabled="disabled=" ng-click="confirm())">Confirm</button>
</div>
I want to click the button, but the code I'm using doesn't work,Help me, please again!!
WebView21.CoreWebView2.ExecuteScriptAsync("document.getElementsByClassName('btn confirm-blue')[0].disabled='';") don't work.
WebView21.CoreWebView2.ExecuteScriptAsync("document.getElementsByClassName('btn confirm-blue')[0].click();") don't work.
I'm using <iframe name="votar" style="display:none;"></iframe>
To submit the form without without redirecting the tab, but the "Type something..." field is not
is not displayed again when submitted.
The submit button is <button class="login100-form-btn"> submit </button>
And I already tried with <button class="login100-form-btn" type="reset"> submit </button>
What clears the field but does not submit the form
I also got the idea to put a link when pressed to send.
The page reloads the field comes back empty but the form is not submitted, doing so
<button class="login100-form-btn">submit</button>
Also tried using <meta http-equiv="refresh" content="5; url=http://www.pseudo.link">
what made the page at a given second refresh all the time
<div class="limiter">
<div class="container-login100" style="background-image: url('images/bg-01.jpg');">
<div class="wrap-login100 p-l-55 p-r-55 p-t-65 p-b-54">
<iframe name="votar" style="display:none;"></iframe>
<form action="https://docs.google.com/forms/d/e/.../formResponse" target="votar">
<span class="login100-form-title p-b-49">Make a comment.</span>
<div class="wrap-input100 validate-input m-b-23" data-validate="Username is reauired">
<input class="input100" type="text" name="entry.???" placeholder="Type something...">
</div>
<div class="container-login100-form-btn">
<div class="wrap-login100-form-btn">
<div class="login100-form-bgbtn"></div>
<button class="login100-form-btn">submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
Just added to the <form> a onsubmit='this.submit();this.reset();return false;'
<div class="limiter">
<div class="container-login100" style="background-image: url('images/bg-01.jpg');">
<div class="wrap-login100 p-l-55 p-r-55 p-t-65 p-b-54">
<iframe name="votar" style="display:none;"></iframe>
<form action="https://docs.google.com/forms/d/e/.../formResponse" target="votar" onsubmit='this.submit();this.reset();return false;'>
<span class="login100-form-title p-b-49">Make a comment.</span>
<div class="wrap-input100 validate-input m-b-23" data-validate="Username is reauired">
<input class="input100" type="text" name="entry.???" placeholder="Type something...">
</div>
<div class="container-login100-form-btn">
<div class="wrap-login100-form-btn">
<div class="login100-form-bgbtn"></div>
<button class="login100-form-btn">submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
You need to add a script.js file or javascript code into your file where you have to write code to submit the form.
And there write submit function with .reset() property and don't prevent the default form action in that code
How can I input a link in the button when I press the button?
<div class="buttons">
<span class="sold-out-tag position-top-right">Best Seller</span>
<button class="btn custom-btn position-bottom-right"> Add to cart</button>
</div>
Also you can trigger a link by JavaScript.
<button
onclick="window.location(this.getAttribute('data-link'))"
data-link="/hello">go to hello</button>
One way could be to use an anchor tag instead of the button and make it look like a button.
HTML:
<div class="buttons">
<a class="btn custom-btn position-bottom-right"> Add to cart</a>
</div>
CSS:
.custom-btn {
border: medium dashed green;
}
Alternatively, you could do:
<button class="btn custom-btn position-bottom-right" onclick="location.href='yourlink.com';"> Add to Cart </button>
Try this:
<a href='http://my-link.com'>
<button class="GFG">
Click Here
</button>
</a>
You can use the anchor tag and provide a Bootstrap class for the button, like,
<a class="btn btn-success" href="link"> Add to Cart</a>
If the label "Add to cart" matches the expectations, we'd be talking about a form. A form that causes an element to be added typically uses the POST method:
<form class="buttons" method="post" action="/path/to/add/to/cart/script">
<input type="hidden" name="product" value="123">
<span class="sold-out-tag position-top-right">Best Seller</span>
<button class="btn custom-btn position-bottom-right"> Add to cart</button>
</form>
Alternatively, there's GET as well:
<form class="buttons" method="get" action="/path/to/add/to/cart/script?product=123">
<span class="sold-out-tag position-top-right">Best Seller</span>
<button class="btn custom-btn position-bottom-right"> Add to cart</button>
</form>
Since GET doesn't carry additional payload, you'll get the same effect with a regular anchor:
Add to cart
You don't want search engine spiders to populate carts, so you typically leave GET for data fetching.
I'm trying to make an Edit Modal using Angular. the td fields get a value from this table and send it to a modal using the (click) event
<tbody>
<tr *ngFor="let mascota of mascotas" class="text-center ">
<td>{{mascota.name}}</td>
<td>{{mascota.birthDate}}</td>
<td>{{mascota.species.name}}</td>
<td>
<button class="btn btn-info mx-2">Detalles</button>
<button class="btn btn-warning mx-2" (click)="openSM(contenido,mascota)">Editar</button>
<button class="btn btn-danger mx-2">Remover</button>
</td>
</tr>
</tbody>
This is the function that I made in the component, used a const in order to get the values and send it to the modal
openSM(contenido, mascota) {
const modalRef = this.modal.open(contenido,{size:'lg',centered:true});
modalRef["mascota"] = mascota;
console.log(modalRef);
}
And this is the modal where I'm tying to get the value
<ng-template #contenido let-modal>
<div class="modal-header">
<h4 class="modal-title">Editar datos de mascota</h4>
<button class="close" aria-label="close" type="button" (click)="modal.close()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form class="form-horizontal form-material" id="editform" autocomplete="off">
<div class="form-group m-t-10">
<div class="col-sm-10">
<label>Nombre de Mascota:</label>
<input class="form-control" type="text" placeholder="Nombre" value="mascota.name" />
</div>
</div>
</form>
</div>
</ng-template>
But when I click on the Edit button it didn't recognize the value
And when I used {{}} the const get an 'undefined' value
Error from Inspect Element
Contenido Data
Is there any way to get that value and put it into the input tag? I want to do the same with the others td fields, but first this needs to work well
Console log of the inputs in the constructor
I have two buttons:
<button onclick=initialize() id="1" data-role="button" data-mini="true" data-corners="false" data-theme="b">Show My Position</button>
<button onclick=calcRoute() id="2" data-role="button" data-mini="true" data-corners="false" data-theme="b">Evacuate !</button>
I want to have the second button disabled by default, and have it enabled if clicking on the first button. How do I accomplish this?
Please see the following answers to questions:
Disable Buttons in jQuery Mobile
How to disable html button using JavaScript?
The simplest approach would be (just a pure example w/out taking into consideration browsers, etc):
<html>
<head>
<script>
function enableButton2() {
document.getElementById("button2").disabled = false;
}
</script>
</head>
<body>
<input type="button" id="button1" value="button 1" onclick="enableButton2()" />
<input type="button" id="button2" value="button 2" disabled />
</body>
</html>