Rich Waters

Ext, Javascript, Notes/Domino, Ext.nd, Ruby on Rails

This is such a simple little fix, I can’t believe I’ve not done it before. What I have been doing is closing the form tag then generating my own. I’ve been using Prototype heavily and all of their functions dealing with forms use the id attribute to find it. Enough talk, here it is, plain and simple:

Event.observe(window,”load”,function(){ document.forms[0].id = document.forms[0].name; });

This requires prototype of course for their event system. The other assumption is that notes is always generating the first form tag on the document which it should be doing unless the doctype on the form has been changed.

Share and Enjoy:
  • Digg
  • Facebook
  • Google Bookmarks
  • Posterous
  • RSS
  • Twitter
U Comment, I Follow - Heavily moderated, SPAM will be dealt with.

4 Responses to “SnTT: adding an ID attribute to Notes generated form”

  1. Hi,
    This could be the final key to completing my web app.
    I want to assign a class to the form tags generated by Domino. I am new to prototype.js and am still trying. Any pointers would be appreciated.

    Adam

  2. adding a classname is pretty easy, especially with prototype. Assuming your using the above script and setting the id attribute on athe form you can use: Element.addClassName(‘formid’,'myclass’)
    or
    Element.addClassName(document.forms[0].id,’myclass’)

    Rich Waters

  3. for those newbies, can you indicate WHERE I should use this code?

    Patrick Kwinten

  4. Patrick,

    Good question, you’re making me jump back into all these demo’s from ages ago :)

    I would say your best bet would be the JS Header, you could pass it through in HTML Head as long as you wrapped it in <script> tags, but that seems messy to me.

    Rich Waters

Leave a Reply