I'm currently using the drop down selection box provided in ChronoForms. Because of some javascript I'm adding, the select element needs to look like this:
Is there a way to add this onchange attribute using the current drop down box, or do I need to delete the drop down box and add the box using the custom html element?
<select onchange="Disable(this,'add','delete');" >
Is there a way to add this onchange attribute using the current drop down box, or do I need to delete the drop down box and add the box using the custom html element?
Hi chriso0258 ,
Please try this in a Load JS action instead:
Bob
Please try this in a Load JS action instead:
window.addEvent('domready', function() {
$('select_id').addEvent('change', Disable(this, 'add', 'delete'));
});
You need to add the select id and 'this' may need to be changed.Bob
I've added your code and the Add/Delete Members button are diabled. However, they remain disabled on any option. I probably don't have a correct variable in place.
The id for the selection box is:
The id for the Add/Remove Members and adding rows custom html code is 'personal_info'. The custom code for the Add/Delete Members button is:
And the JS code in the Load JS action I'm using including your code is:
I have not included the JS code for adding the rows since that part is working, however it is in the Load JS action as well.
The id for the selection box is:
<select id="membership" class=" validate['required']" name="membership" title="" size="1">
The id for the Add/Remove Members and adding rows custom html code is 'personal_info'. The custom code for the Add/Delete Members button is:
<INPUT name="add" disabled="disabled" type="button" value="Add Member" onclick="addRow('dataTable')" />
<INPUT name="delete" disabled="disabled" type="button" value="Delete Member" onclick="deleteRow('dataTable')" />
And the JS code in the Load JS action I'm using including your code is:
window.addEvent('domready', function() {
$('membership').addEvent('change', Disable(this, 'add', 'delete'));
});
function Disable(s,d1,d2){
var frm=s.form;
frm[d1].disabled='disabled';
frm[d2].disabled='disabled';
if (s.value&&s.value>10){
frm[d1].removeAttribute('disabled');
frm[d2].removeAttribute('disabled');
}
}
I have not included the JS code for adding the rows since that part is working, however it is in the Load JS action as well.
This topic is locked and no more replies can be posted.