Symfony - how to disable/readonly select which can hold data on submit? - symfony

If you disable select, data of that select will not be added do response. How to prevent user not to dropdown select and hold data at the same time?

You can simply achieve that using simple onclick event....in bootstrap dropdown you have your tag select and also you have some html added by bootstrap, find BUTTON tag which open your dropdown and get it DATA as selector
$('button[data-id="xxxxxx"]').on('click',event => { return false; })

Related

checkAll, uncheckAll not working properly post user interaction with an individual checkbox

I have recently learnt angular from udemy. I was trying to use this a custom checkbox in my angular app. The problem is not with the checkbox itself but the ui not getting updated on checkAll, uncheckAll after user interaction with an individual checkbox
My implementation on stackblitz
Things i have tried:
using timeout (i have used it to get autofocus working)
using ChangeDetectorRef detectChanges()
using template forms but tr/tbody won't render even if i wrap tbody in it
using reactive forms (not very sure if i did it correctly)
Steps to reproduce:
click on any checkbox but the first one.
click on the first checkbox checkAll, uncheckAll... It doesn't work on the checkbox clicked in the first step.
The checked attribute describes the default state of the field. Removing it will have no effect if the field has been interacted with (or if its checked property has already been modified). сhecked property can be modified by user interaction(click on checkbox)
You should be manipulating checked property instead since it represents the current state.
checkAll() {
const inputs = document.querySelectorAll<HTMLInputElement>('input[type=checkbox]');
inputs.forEach(input => input.checked = true)
}
uncheckAll() {
const inputs = document.querySelectorAll<HTMLInputElement>('input[type=checkbox]');
inputs.forEach(input => input.checked = false)
}
Forked Stackblitz
Note: this is not quite Angular way to work with form controls. You shouldn't be touching DOM directly in order to update control value

CRM Ribbon Workbench - Hide + Button on Sub-Grid

I have a sub grid on a new entity called Issues, the sub grid is for another new entity called Cost Detail.
I have them both loaded into my solution called Issue, and have opened issue in the ribbon workbench.
What I want to do is when you are on the Issue form and can see the sub-grid I want to be able to hide the + button which is displayed. However when I have hidden this button in the ribbon workbench it also hides the add new button in the 'Associated View' therefore no records can be added.
How do I do it so that only the + button on the sub grid is hidden and not the other view?
EDIT:
In order to hide the add button, you either need to take away create privileges to the role that the user is in or you could do a hack(unsupported) like this:
function hideAddButton(){
var addButton = $('#NameOfGrid_addImageButton');
if(addButton.size())
addButton.hide();
else
setTimeout(hideAddButton, 1000);//checks every second to see if the button exists yet
}
and call the hideAddButton function on form load
There is one answer that I found. If you have a field that unique for that entity, then you can do it with a simple javascript code.
Here is steps that you must follow in ribbon workbench:
Right click the button and customise button.
Add an enable rule, in Steps section add an Custom Javascript Rule, that contains your library and function name, please make sure that default is true.
This must be in your javascirpt library :
function hideAddNew(){
if(Xrm.Page.getAttribute("yourField")){
return false;
}
else {
return true;
}
}
Add a command that contains the enable rule we created.
Add the command to button.
That's it. I test it, it is working.

JavaScript calendar in Drupal (Scheduler module)

hi i have installed scheduler module from drupal.org. and i have set all the settings regarding this. now i can set publish and unpublished date in text box(there is format of date below text box).
i want to use java script calendar so when user click on the text box ,the calendar should open.
how can i do this
Since you're using Drupal you should have JQuery preloaded. You don't necessarily need JQuery to do this but it makes it easier, you'll use JavaScript either way.
With JQuery, simply setup a click listener on the textbox and have it call the whatever function triggers the calendar display like so...
Note: I used a simple ID selector below "#textbox" replace it with whatever way you want to select your textbox input. (eg. if you've given the HTML textbox input element an ID of "textbox" you can use my example)
$(document).ready(function(event) {
$('#textbox').live('click', function() {
//call your function here
});
});

Choose Enter Rather than Pressing Ok button

I have many fields in the page and the last field is a dropdown with list of values. When I select an item in a dropdown and press Enter, it doesn't do the "Ok". Instead I have to manually click on Ok to Submit. How can I do by pressing Enter on my Keyboard rather than Clicking on "Ok" button after selecting the value from dropdown list. I have set the SubmitBehavior to true.
Try the solution here: ASP.NET 2.0 - Enter Key - Default Submit Button.
Assuming you're talking about a web form:
I'm no ASP.NET guru, but the default behavior of an HTML form is to submit in this case. Common causes for this are the HTML form fields not being contained within the form element, or the submit button having a nonstandard javascript function fire instead of submitting proper.
I realize that's not an answer, but I hope it might help.
using jquery you can do something like this
$("#fieldName").keypress(function(event)
{
if (event.keyCode == 13)
{
return true;
}
else
{
return false;
}
});
See more here: http://docs.jquery.com/Events/keypress
Try setting Page.Form.DefaultButton = OkButton; in your code-behind.

Dynamic Slidedown effect using jQuery reading data from a table

I want to list some records from the table in a ASP.NET page. For each record, I want to display some data and at the same time, provide a button for them to click. I want to show a “CLICK TO VIEW BUTTON” If they click on the button, I want to have a box slide down (using jQuery) to display the other details for the record. An example of what I am looking for can be found here.
Sample of drop down
I would prefer to have one function to handle the details. I would like the box to appear right underneath each record and not at the bottom of the page. Is there a way to do this using jQuery? I was looking at the wrap, append but was not sure on how to go about implementing this.
Put the box in your ASP markup, but hide it:
Show details
<div id="details123" style="display: none"></div>
Now implement a function to show/load:
function showDetails(recordId) {
var detailsDiv = $("#details" + recordId);
// load stuff -- replace this with whatever is
// appropriate for your app
$.getJSON("/myapp/someJSONfunction?recordId=" + recordId,
null,
// this will be run if successful
function(data) {
if (data.value) {
detailsDiv.text(data.value).slideDown();
}
}
});
}

Resources