Combination of eDefInputText and eDefBrowseButton
BorisB - June 29, 2008 - 22:10
| Project: | BUEditor |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I'm trying to create a bueditor button for inserting images via imce, imagecache- and lightbox-aware (thus combining image and link). Most parts are working fine, but i don't succeed in combining a textfield with the imce browser. Here is what i tried to do (simplified):
js:
processImage = function(form) {
... processing the form values
}
var html = eDefInputText ('src','',50) + eDefBrowseButton('/imce/browse', 'src', 'Lookup', 'image') + eDefInputSubmit('sbmt', 'Insert');
html = eDefHTML('form', html, {onsubmit: 'processImage(this); return false;'});
editor.dialog.open ('Insert Image', html);The form gets rendered correctly and pressing the "Lookup" button opens the imce window. But then, clicking "add" doesn't close the Browser, and the filename isn't inserted in the form. How can i do this correctly?
Thx,
Boris B.

#1
if you want your src, href, width or height fields automatically filled, prefix them with attr_
that's, src should be attr_src.
Note: if you use eDefTagDialog, this is done automatically.
And i think it is shorter to code:
eDefTagDialog('img', [{name: 'src', title: 'URL', attributes: {size: 50}, suffix: eDefBrowseButton('/imce/browse', 'attr_src', 'Lookup', 'image')}], 'Insert Image', 'Insert', 'processImage');
processImage = function (tag, form) {
form.elements['attr_src']...
}