Total noob here, so any help is appreciated.
I have a form that I am editing in advanced mode. I want to add an onBlur() event to one of the fields in the form. I've successfully added the javascript that I want executed via the Load JS event, but how do I actually add the onBlur event to the textbox on the form? I can do it the "non-wizard" way by editing the code itself, but then when I go back and do anything in the wizard and save it that code gets over-written.
Thanks!
I have a form that I am editing in advanced mode. I want to add an onBlur() event to one of the fields in the form. I've successfully added the javascript that I want executed via the Load JS event, but how do I actually add the onBlur event to the textbox on the form? I can do it the "non-wizard" way by editing the code itself, but then when I go back and do anything in the wizard and save it that code gets over-written.
Thanks!
Hi LandShark,
Add an id to the element e.g. my_element
Drag a Load JS action into the On Load event and add code like this
Bob
Add an id to the element e.g. my_element
Drag a Load JS action into the On Load event and add code like this
window.addEvent('domready', function() {
$('my_element').addEvent('blur', xxx);
});Where xxx can be a function name or a function containing the code you want to execute.Bob
Hi Bob,
I tried above solution for my form, but still seem to have done something wrong.
value of FieldId 'postcode' should be changed to caps and removal of spaces
the code I have in LOAD JS:
could you please tell me what I'm doing wrong?
thanks in advance,
Jan
I tried above solution for my form, but still seem to have done something wrong.
value of FieldId 'postcode' should be changed to caps and removal of spaces
the code I have in LOAD JS:
window.addEvent('domready', function() {
$('postcode').addEvent('blur', removeSpaces);
});
function removeSpaces(string) {
return string.split(' ').join('').toUpperCase();
}could you please tell me what I'm doing wrong?
thanks in advance,
Jan
Hi Jan,
You aren't passing a parameter when you call the function so 'string' is probably undefined. Please try this JavaScript:
Or, more simply if you only need it on one input:
Bob
You aren't passing a parameter when you call the function so 'string' is probably undefined. Please try this JavaScript:
window.addEvent('domready', function() {
$('postcode').addEvent('blur', removeSpaces);
});
function removeSpaces() {
$('postcode').value = $('postcode').value.replace(' ', '').toUpperCase();
}Or, more simply if you only need it on one input:
window.addEvent('domready', function() {
$('postcode').addEvent('blur', function() {
$('postcode').value = $('postcode').value.replace(' ', '').toUpperCase();
});
});Bob
This topic is locked and no more replies can be posted.
