/* Set focus, and place the cursor at the end of the input string */
dojo.addOnLoad(function() {
- dijit.byId('search_box').focus();
+ /* Don't error out if the object doesn't exist, like on advanced search pages */
+ if (dojo.byId('search_box')) {
+ dijit.byId('search_box').focus();
- var sb_value = dijit.byId('search_box').value;
- /* Dojo won't trigger a change if the value doesn't change */
- if (sb_value) {
- dijit.byId('search_box').setValue(sb_value + ' ');
- dijit.byId('search_box').setValue(sb_value);
+ var sb_value = dijit.byId('search_box').value;
+ /* Dojo won't trigger a change if the value doesn't change */
+ if (sb_value) {
+ dijit.byId('search_box').setValue(sb_value + ' ');
+ dijit.byId('search_box').setValue(sb_value);
+ }
}
});
</script>