This topic is locked

JS Function for Extension

Posted 21 Feb 2006 15:43:03
has voted
21 Feb 2006 15:43:03 James Threadgill posted:
I am currently working on extension that requires an id attribute on the field I'm working with. By default DW doesn't use the id attribute. I am looking for a js function which prevents the user from applying the extension if the field has no id attribute.

Even better would be a f8unction which added the id attribute, but this gets dicey as the id must have name value. Perhaps one could copy the value from the name attribute and use it for the value.

Any ideas?


Replied 22 Feb 2006 00:41:57
22 Feb 2006 00:41:57 James Threadgill replied:
Well, I guess I've got to answer my own question. So here it is. This code block adds the id="thefieldname" and runat="server" to the file input field when I apply the server behavior.
<font face='Courier New'>
var TheList = MM_findObj("UploadField";
var strFieldName = TheList.options[TheList.selectedIndex].value;
var theDOM = dw.getDocumentDOM();
var TheFileFiel = MM_findObj(strFieldName, theDOM);
if(TheFileFiel){TheFileFiel.runat = "server";
if(TheFileFiel){ = (strFieldName);}
</font id='Courier New'>

Now on to the next problem: My behavior uses a tag menu which gets its values from the DW parameter tags. The tag menu selects the parameter I wish to apply the server behavior on. When I select the parameter tag to apply the behavior to I also need to put the parameter tag name value into a hidden field in my SB Form.

Any folks with ideas?

Edited by - on 22 Feb 2006 01:05:14

Reply to this topic