Forums

This topic is locked

Form Control

Posted 23 Oct 2001 16:07:33
1
has voted
23 Oct 2001 16:07:33 Some One posted:
How can i control form in a page for my extensions ?

Like this
"Please create a form before apply Insert Record" etc..

sdi ::: pixels to blood

Replies

Replied 24 Oct 2001 14:47:06
24 Oct 2001 14:47:06 Bruno Mairlot replied:
1. You get the DOM of the current document with :
<pre id=code><font face=courier size=2 id=code>var theDOM = dreamweaver.getDocumentDOM("document";</font id=code></pre id=code>
2. Then you check if there is any FORM tag within the document with :
<pre id=code><font face=courier size=2 id=code>var formArr = getElementsByTagName('FORM');</font id=code></pre id=code>
3. If the array is empty (<pre id=code><font face=courier size=2 id=code>formArr.length==0</font id=code></pre id=code> then there is no form tag in your document.
If there is , then the formArr is an array containing all the nodes referencing to the form tag of your document.

Bruno

--- Better to die trying, than never try at all ---
Replied 24 Oct 2001 18:33:52
24 Oct 2001 18:33:52 Waldo Smeets replied:
Shouldn't it be:
<pre id=code><font face=courier size=2 id=code>
var theDOM = dreamweaver.getDocumentDOM("document";
var formArr = theDom.getElementsByTagName('FORM');
if (formArr.length ==0) {
alert("Please create a form before apply Insert Record"
}</font id=code></pre id=code>

Waldo Smeets - www.UDzone.com Webmaster
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 24 Oct 2001 18:36:54
24 Oct 2001 18:36:54 Bruno Mairlot replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Shouldn't it be:
<pre id=code><font face=courier size=2 id=code>
var theDOM = dreamweaver.getDocumentDOM("document";
var formArr = theDom.getElementsByTagName('FORM');
if (formArr.length ==0) {
alert("Please create a form before apply Insert Record"
}</font id=code></pre id=code>
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Wasn't it what I wrote ? You put the code, I put the explanation <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>



--- Better to die trying, than never try at all ---

Edited by - Maehdros on 10/24/2001 18:38:32
Replied 24 Oct 2001 18:40:57
24 Oct 2001 18:40:57 Waldo Smeets replied:
No your code was incorrect... you did not use the DOM as you wrote:

var formArr = getElementsByTagName('FORM');

instead of

var formArr = theDom.getElementsByTagName('FORM');

I know it was just a typo <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Waldo Smeets - www.UDzone.com Webmaster
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 25 Oct 2001 13:21:46
25 Oct 2001 13:21:46 Some One replied:
Oh thanx...
Also i use that : it works...

if(dw.getDocumentDOM().getElementsByTagName("FORM".length &lt;= 0){
alert("Create a form first";
}

How can i learn more about UD Dom system but must be from basics.


Edited by - soul on 10/25/2001 13:25:11
Replied 25 Oct 2001 13:48:26
25 Oct 2001 13:48:26 Bruno Mairlot replied:
The "Extending Dreamweaver And Ultradev" document is the place you'll find all functions of the DOM.

You can access it in Dreamweaver by the Help Menu -&gt; Extending Dreamweaver

The function of the DOM and DREAMWEAVER are all described in the chapter JavaScript API.

--- Better to die trying, than never try at all ---
Replied 26 Oct 2001 10:26:56
26 Oct 2001 10:26:56 Waldo Smeets replied:
Soul, the UltraDev DOM and all it's methods are documented by Macromedia in the book that Maehdros mentioned. BUt that book really only just is a list of all the functions. You really should feel comfortable in using javascript before you dive into it. And even then that Macromedia Book is not easy to use.

Tom Muck has written a nice book for everyone who is starting to develop dreamweaver extensions. Read more about it here: www.UDzone.com/go?726

Waldo Smeets - www.UDzone.com Webmaster
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Reply to this topic