I am using ajax to populate the multilevel checkboxes dynamically depending on the users selections. Like choosing one or more options from first checkbox group will update new checkbox list and so on. I am adding the checkboxes to div. All the checkboxes are arranged using the table structure inside the form element.
Now to access checkbox as a group i take the checkbox controls on checkbox click using function selectElement(this) using which i get the checkbox and using which i retrive the Form control. However in Mozilla the chkControl.form is coming null and after trying to find solution i failed to find why ? can nesting form element wrongly in table structure cause such an issue ?
function selectElement(chkControl)
{
var frm = chkControl.form; //this in mozilla is returning null
//frm processing code
}
Related
I have a select list on my page and I created a dynamic action on the list to execute some javascript based on selected value. I tried using
var sel_val = apex.item("P2_TYPES").getValue();
but it did not return the selected value
also tried using $x('P2_TYPES') but still unsuccessful - returns false
How can I retrieve a selected value of a select list from a dynamic action?
Only with this information I can't say why this is not working, but the code is correct.
This will works.
Create a dynamic action
WHEN: change a item.
no condition
True action: execute javascript code
alert(apex.item("ITEM_NAME_HERE").getValue())
I have an accordion that uses the datasource Competency, which stores a list of core competencies for their employees and the related metadata (such as a description). Inside the Accordion's detail, I have a panel that uses the Comment datasource. A user can then enter a comment that will get related to the Competency datasources with some unrelated logic.
Right now, I have an empty checkbox (check_box_outline_blank) in the Accordion Row. When a user enters text, I want the checkbox to have a check (i.e. change the value from check_box_outline_blank to check_box) The problem is that I'm not able to figure out a way to select the checkbox.
Selecting with widget.parent.parent.parent.parent.parent.parent.children.DetailAccordionRow.children.CompletionIcon.text = "check_box"; results in the error
Cannot read property 'children' of undefined
at CheckinSubmit.RootPanel.FormPanel.AccordionPanel.DetailAccordion.DetailAccordionDetail.AccordionDetialPanel.CommentFormPanel.CreateCommentForm.CreateCommentFormBody.Field.onValueEdit:1:78
Selecting with app.pages.CheckinSubmit.children.RootPanel.children.FormPanel.children.AccordionPanel.children.DetailAccordion.children.DetailAccordionRow.children.CompletionIcon.text = "check_box";
Throws the error:
Cannot read property 'children' of undefined
at CheckinSubmit.RootPanel.FormPanel.AccordionPanel.DetailAccordion.DetailAccordionDetail.AccordionDetialPanel.CommentFormPanel.CreateCommentForm.CreateCommentFormBody.Panel3.onValueEdit:1:140
Both commands were put into the Submit button's onValueEdit trigger.
I've been using AppMaker's autosugguestions to generate both of these commands. I'm not sure how else to select this item. Here's a screenshot with the UI and outline:
Did you try to use binding? It seems, that you are adding Comments to the Competency, so maybe this binding for the label's text will work?
#datasource.item.Comments.length > 0 ? 'check_box' : 'check_box_outline_blank'
when a user enters text, I want the checkbox to have a check
if you want exactly this behavior, and you have properly configured bindings, then you can bind label's text to something similar to this:
#datasource.relations.Comments.modes.create.item.Comment !== null ?
'check_box' : 'check_box_outline_blank'
Note that bindings will be reevaluated on focus loss of the Comment input (but there is a workaround for that).
I have a javascript file that when called, checks to see if a particular option is selected on a form. The form allows for multiple selections before being submitted. When a particular item is selected within the given choices it shows a hidden menu. In this case with "audits" I am able to show the hidden menu fine when just "audits" is selected from the list. However, I'm having much difficulty in figuring out how to get the menu to show when "audits" would be selected/highlighted with others. Eg: I had audits, services, someotheroption
Below you can see the code I'm currently using and that's working only when the single item is selected. Any guidance would be much appreciated.
function toggleFields(){
function toggleFields(){
if ($("#installations").val() == "audits"){
$("#dbcredentialsfield").show();
}
else
$("#dbcredentialsfield").hide();
}
Using the code you have so far, I assume you probably want something like this:
$('#installations').on('change', function(){
$("#dbcredentialsfield").toggle($(this).val() == 'audits');
});
This says; when the select element (assuming your dropdown has the id of installations) changes, toggle the visibility of the element with id dbcredentialsfield depending on if the value of the select is audits or not.
I need to select the header checkbox when all the rows are selected.
I used logic to keep a count of the number of rows checked if it's equal to row_count,I need to select the header checkbox
The problem is I cannot access the header checkbox through DOM because of the browser restriction
I'm using the following jquery code to get it worked but it's not working as expected
var check_box = fw.component_helper.get_table_column_editor(fw.form_constants.CHECK_BOX);//header checkbox
$("check_box").attr('checked',true);
Note: fw is my own defined framework
Please suggest what's wrong with this approach
use prop instead of attr. What is "$('check_box')". Define weather it is class or id. you selector is wrong here I thing this could be problem.
$(".check_box").prop('checked',true);
or
$("#check_box").prop('checked',true);
or
$("input[type='checkbox']").prop('checked',true);
I have a table with a bunch of rows. In the last column of every row, there is a dropdown. When the dropdown changes, I need a new table row to appear below the row where the user selected the dropdown item. However, I also need the new row to have different data depending on what was selected in the dropdown.
Is any of this possible using only jQuery?
Note that I'm using ASP.NET for back-end development, so if a solution can be found without using ID's that would be great.
$("table select").live("click",function(){
var row=$(this).parent().parent();//add some .parent() untill you get the TR element
var val=$(this).val(); //<select> value if you want to use it for some conditions
$("<tr><td>....</td></tr>").insertAfter(row);
})
It's simple enough to add the HTML using JQuery. However, if you intend to save this data back to the server, the default ASP.NET process (using ViewState) will ignore the new rows. Instead, you would need to directly read the submitted form properties.
To learn how to add a row, look at the suggestions here: How to add a new row to a specified table with jQuery?