From: Michael P. <mp...@ph...> - 2001-02-08 04:36:40
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> This is where my form object was deisgned to be used. It allows you to dynamically add and remove elements from the form. The code is attached. <p>At the moment, it will only work with get forms (data is submitted in the url). <p>Eventually, I'll make a way of extending existing widgets to make then act as form elements. <p>This is how it works: <p>DynAPI.include('afrogui.form.form'); <br>DynAPI.onLoad=function() { <br> testForm=new DynForm("<A HREF="http://www.altavista.yellowpages.com.au/cgi-bin/query">http://www.altavista.yellowpages.com.au/cgi-bin/query</A>"); <br> testForm.addElement(new FormObject('mss','simple')); <br> testForm.addElement(new FormObject('pg','q')); <br> testForm.addElement(new FormObject('kl','en')); <br> testForm.addElement(new FormObject('what','web')); <br> query = testForm.addElement(new FormObject('q','+jscript +download +url +contents +source +code')); <br> alert("A search form is about to be submitted to Altavista."); <br> testForm.submit(); <br>}; <p>This sample creates a form used to search altavista. In the FormObject, the first parameter is the value name and the second is the default value. <p>To show what could be done, check out <a href="http://www.abchostonline.com/users/mpember/afroapi/examples/demos/dialog_goeureka.html">here</a>. It also uses a few of my other widgets (dialog, textbox, button, etc). <p>Strolia-Davis Christopher Contr MSG MAM wrote: <blockquote TYPE=CITE>Luca, <p>The DynAPI could really help with something like this. Because of some <br>caveats with Netscape, this can be really difficult to do without using <br>layers. Yes you can add fields to the form, but getting them to actually <br>show up without a history.go(0) and then losing all of your previously <br>entered data is a pain. <p>What may work better is to create an array to hold your clients values. <br>Then use a setHTML on a layer to create the form object and display it to <br>the user. When the user wants to add a control, add some info about it to <br>the array, and make sure you are saving value information to your array as <br>well. The recreate the form text and set the HTML to the layer again. <p>There may be a better way, but this is what jumps to mind. <p>Hope this helps you get started, <p>Later, <p>Chris <p>-----Original Message----- <br>From: Luc...@me... [<a href="mailto:Luc...@me...">mailto:Luc...@me...</a>] <br>Sent: Wednesday, February 07, 2001 3:19 AM <br>To: dyn...@li... <br>Subject: [Dynapi-Dev] Create a form which "grows" as user needs <p>Dear DynApi-Dev <br>I am trying to use DynAPi in order to create a page which "grows" before <br>submission. <br>Namely, <br>A page is generated which contains some fields to fill in. <br>However there is one field which may have multiple values. <br>SInce is not known how many values the user would need to have, and would <br>be extremely <br>poor from a stylistic point of view either hardcode the number of fields or <br>use a CGI-posting method <br>to iterate until the final submit is given, I would like to use DynApi to <br>do that. <p>I have checked dozens of DHTML and Javascript sites as well as dejanews but <br>could not figure how <br>to do that in practical terms. <p>I have then tried with dynapi and failed. <p>I would very much appreciate your support / suggestions. <p>In my opinon, the DynApi does not yet implements ways to handle the above <br>problem. <br>I have tried with the List object but always got the IE5 to crash. <p>I will very much appreciate your advice. <br>Sorry for the triviality of the question. <br>Luca <p>_______________________________________________ <br>Dynapi-Dev mailing list <br>Dyn...@li... <br><a href="http://lists.sourceforge.net/lists/listinfo/dynapi-dev">http://lists.sourceforge.net/lists/listinfo/dynapi-dev</a> <p>_______________________________________________ <br>Dynapi-Dev mailing list <br>Dyn...@li... <br><a href="http://lists.sourceforge.net/lists/listinfo/dynapi-dev">http://lists.sourceforge.net/lists/listinfo/dynapi-dev</a></blockquote> -- <br>Michael Pemberton <br>mp...@ph... <br>ICQ: 12107010 <br> </html> |