When I enable Extended search on a field which i used in startup script
example:
$("#x_payBy").change(function() { ..... });
This code seams will not work if the extended search for payBy is enabled.
any solution for this?
When I enable Extended search on a field which i used in startup script
example:
$("#x_payBy").change(function() { ..... });
This code seams will not work if the extended search for payBy is enabled.
any solution for this?
Your code may or may not work depending on the Edit Tag of the field. You better use Client Side Events instead.
My code is under Client Scripts->Table Specific->Add/Copy page->Startup Script.
Tested the the code by enabling the Extended search and disabling the extended search.
The client script is not working when I enable the Extended search on the change function field.
My sample code:
Code: Select all
$("#x_payBy").change(function() {
if (this.value == 'CH'){
$('#x_baID').empty();
$('#r_baID').hide();
} else if (this.value == 'TT') {
$('#x_baID').empty();
$('#r_baID').show();
} else if (this.value == 'CD') {
$('#x_baID').empty();
$('#r_baID').show();
} else if (this.value == 'CR') {
$('#x_baID').empty();
$('#r_baID').hide();
} else {
$('#r_baID').hide();
}
});
$("#x_payBy").triggerHandler("change");
innovativeshadow wrote:
My code is under Client Scripts->Table Specific->Add/Copy page->Startup Script.
Extended Search is in the List page.
If you use Client Side Events, it should work in all pages. You may also use the .visible()
method of jQuery .fields() Plugin in client side events.
To check JavaScript error, press F12 in your browser and go to the Console panel.
In the below code
Not a best place it seems to use a client script for manipulating fields.
Code: Select all
{ // keys = event types, values = handler functions
"change": function(e) {
$row = $(this).fields();
if ($row["payBy"].value() == 'CH'){
$(this).fields("baID").value("");
$(this).fields("baID").visible(false);
} else if ($row["payBy"].value() == 'TT') {
$(this).fields("baID").disabled(false);
$(this).fields("baID").visible(true);
} else if ($row["payBy"].value() == 'CD') {
$(this).fields("baID").disabled(false);
$(this).fields("baID").visible(true);
} else if (this.value == 'CR') {
$(this).fields("baID").disabled(true);
$(this).fields("baID").visible(false);
} else {
$(this).fields("baID").disabled(true);
$(this).fields("baID").visible(false);
}
}
}
$row["payBy"].value()
but then check this.value
, make sure they are correct,