When clicking add or edit in a Grocery Crud grid, I need to explain what the purpose of a certain field is to assist the user in completing the form by putting some custom text next to the field called "Active" that is a select box, so that it looks like this:
Active? [Select active] Note: select Yes to ensure that your event is activated.
How can I do this?
Unfortunately, I was forced to do a bit of a hack, as the client urgently needed this done. I have done it by using jQuery to append a string to the select box on document.ready(). If there is a better way, I will gladly adapt, and accept that answer instead, but for now, the above solution works.
Related
Any help would be highly appreciated.I am working on Nintex form and currently stuck with this rule to be worked.
I have first checkbox as YES/NO (Name: NA), trying to create a rule where automatically all the options (Name:Options) below automatically go uncheck when somebody clicks on this first "Not Applicable". If it could hide all the below options after clearing that would be great but not requirement. Definitely clearing them out is requirement.
Is there anyone who can help me with this. Thank you.
It would really help to see some screenshots of your form and it's controls.
However, I can tell you that a rule will not be able to change the values of another control. For this, you're going to want to use JavaScript in the Settings -> Custom JavaScript section.
I will often show/hide a portion of a form based on the selection of a control. And, when the section is hidden, I always want to clear out any data that may have been entered into those (now hidden) fields.
Here's an example:
Image of Form Example
And here's the code:
NWF$('#' + myYesNo).change(function(){
NWF$('#' + myChoices + ' input').prop('checked',false);
});
Every time the Yes/No field is checked, everything in the Choices field is unchecked.
I would also suggest adding a rule to the Choices field (and its label) that says not(myYesNo): like this.
If you didn't want to hide the choices, I would expand the JavaScript to test whether or not the Yes/No is currently true or false. However, hiding the choices entire remove the need for that test.
Say you had a combobox like this one:
How would one allow the user to delete an entry listed in the combobox? What element would you add, such as an additional button, context menu ...?
I think small 'x' mark at the right side would be sufficient here.
However I think better solution is to use something like select2: https://ivaynberg.github.io/select2/
.
I believe users are more familiar with this kind of input.
I have a question on the subject of composite attributes that I would be grateful if you could help me with.
I posted this before on other question blogs but got no response I am satisfied with.
I am writing JavaScript that will update the fields (i.e. address1_line1, address1_line2, address1_line3, address1_city, address1_stateorprovince, address1_postalcode, address1_country) in the composite (address1_composite). When the fields are updated the composite does not seem to update. I have to open the composite and close it again. Is there a way of doing this automatically in JavaScript?
I have tried the following ideas:
Idea 1:
Xrm.Page.data.entity.save();
This is recomended at http://community.dynamics.com/crm/b/magnetismsolutionscrmblog/archive/2013/10/22/working-with-dynamics-crm-2013-composite-fields-fly-out-menu.aspx
This is not any good as my customers want to view the composite before saving the page. Also I would not want to save the page for my customers as they do not want this. They would like to decide when to do this themselves.
Idea 2:
Xrm.Page.data.refresh();
This is not really what I wanted as I do not want to refresh the whole page. I just want to refresh the composite. Also it bring up a popup that warns you about not having saved the page which will be annoying for my customers.
Idea 3:
Writing the address from the address lines to the composite.
This feels like a nasty hack.
There is probably more than one way of doing this. I used the function
Xrm.Page.getAttribute("address1_composite")._attribute.setValueForCompositeField();
I do not like this for the following reasons:
This is a hack as it is not using the system functionality of the done button to write the data.
You do not get the system formatting you get with the done button although this will get done when the form is saved so it is not so bad.
In the future if customers are allowed to add their own composite fields it could cause problems as the field names could be different.
It requires me to write extra code for each form that has a composite which has fields with different schema names. E.g. I have to write different code for forms with ShipTo and BillTo addresses as the code for the account form will not work.
Another idea was to set the focus to the composite field after a change has been made to any of the fields inside the composite.
Xrm.Page.data.entity.attributes.get("address1_composite").controls.get(0).setFocus();
This is the best idea so for but it is far from perfect. This forces the user to press the done button and hence the fields will be written. I was hoping for something more automated.
My Question:
What would be great is if there was a way to click the composite done button in JavaScript. This would give me the formatting of the done button and the automation I need.
Update - 14/04/2014
Since posting this question I have been in contact with Microsoft and they say there is no supported way of clicking the done button via a program.
If the field is locked down CRM JavaScript does not send the data back to the server for updating. Another approach would be:
perform the update using JavaScript (so the user sees the change); and
use a server side plugin on the Update event so the value is persisted.
I set up a simple form with Chronoform V4. One of the field need to be kinda dynamic.
for example,
do you know your id, if yes, then input id.
if not, then there are other filelds need to be filled, such as name, birthday, sex etc.
but if you know the id, those fields should be grey out or something etc.
How can I do this in joomla? Many thank
Your best bet? Hop on the forums over at www.chronoengine.com - not only are the developers super friendly, I have seen them custom code stuff for their users more times than not.
They know the stuff best and will definitely be able to help you.
That said, there are ways to add custom code snippets to chronoforms - I recommended using javascript to accomplish your goal. I have done something similar and chronoforms + javascript = wonderful result.
If you've created your form with their wizard, go into your forms and click Wizard Edit.
From there on the right hand side you should see an 'Events' tab - click that.
In the 'On Load' event, you'll want to add 'Load JS' from the menu on the left. Then you can open that, and add your javascript to control your choices. The javascript will load when the form does and you can control the user selections exactly how you're requesting.
I am managing to construct a form (with FuelCMS) that has a look-up table, and the look-up table has a field that must be inserted at the same time as the relation (Figure 1).
Using a model inside my module I have finished the form to insert the data, I have a control (Figure 2) to select the relation between the two tables, and here is where my question comes. I need to show a pop-up (like the one when you press the "ADD" or "EDIT" button that allow the user to insert the value of the "objetivo" field (Figure 1) at the time you assign "Hitos" to the "indicadores".
What is the best way to do this? Can I attach a JS file to the form from the module to be able to capture the button click and show the pop-up? There are another better way already to achieve that task?
I hope I made my point clear, if not, please tell me and I will try to explain myself better.
Thanks :)
Figure 1
Figure 2
Thanks to the kind of the FuelCMS team I was at the end able to solve the situation I explained before, to achive the aim you should follow the next steps:
Add a javascript file on the module config (fuel/modules/MODULE_NAME/config/MODULE_NAME_fuel_module.php)
Use the Javascript hooks 'selectionAdded' and 'selectionRemoved' to launch the popup (FuelCMS uses jqmodal as popup) the functions pass as a parameter an array "vals" that contains the ID of the selected items.
Add a AJAX request in the popup code to retrive the form
Process the form and keep the values for later saving on database or manipulatiĆ³n.
It could be a bit tricky if you need a complex logic but is an effective way of do it :)
Once again TAHNKS to the FuelCMS support people, i hope this help someone.
Best regards.