Page 1 of 1

Custom form with transient fields and custom javascript

PostPosted: Mon Mar 07, 2011 9:06 am
by neotrode
Hello.

I have a particular case in which I need to implement a javascript active form. The form will have much of the standard layout associated with the use of Xataface (fields.ini, valuelists, etc...). However, one particular table's form needs to have a special section that will hide and unhide nested forms in a div (probably by ID) depending on what you choose in the form. I have no problem copying the standard header template over to the custom area and associating a private javascript to include. However, how do I create transient forms that are nested in my own Div IDs that will be controlled by my transient/delegate calls?

To ease this, I was wondering if it is it possible to insert a block of html of my own in a form? One that contains transient fields directly related in the fields.ini. I would then use the delegate class to work on code to handle data entry of the transient fields. The tricky part is being able to include my own section of form data in the data entry form.

I look forward to your help.

Kind regards,
Frank

Re: Custom form with transient fields and custom javascript

PostPosted: Mon Mar 07, 2011 11:37 am
by shannah
In cases like this, I often just create a transient text field that is ultimately used to send the data back to the server. Then, using javascript I:
1. Hide the text field.
2. Create my other cool widgets
3. Cause my other cool widgets to store data in the original text field so that it will be submitted back to the server on submit.

-Steve

Re: Custom form with transient fields and custom javascript

PostPosted: Mon Mar 07, 2011 2:18 pm
by neotrode
Gotcha. I'll give it a shot.

As always... Thanks Steve

Re: Custom form with transient fields and custom javascript

PostPosted: Sat May 07, 2011 10:38 pm
by myrtlee
Whats the best easiest and fastest way to leanr php javascript and more? Ok i have sortaish learnt html and want to further it into javascript to start out i think. Im using the W3school thingy to see about it but I just don understand how im supposed to learn it. So i just copy the code and use it a lot when i need it to get the hang of it or somthing?? How should i go about learning these things?? Thanks so much!

Re: Custom form with transient fields and custom javascript

PostPosted: Sun May 08, 2011 10:23 am
by shannah
Good question. It's a good idea to try and learn about each of these individually:

1. HTML + CSS (these are 2 topics but they are so closely intertwined that you can't very will master one without the other).
2. PHP
3. Javascript
4. SQL

Although there are plenty of great reference resources online for each of these topics, I find that, at least at the beginning, a book can really help for getting you acquainted with the ropes. E.g. Learn X in 7 days, or any of the O'Reilly books.

In the case of Javascript, I highly recommend the 5 part video talk by Douglas Crockford. The first part is here
http://developer.yahoo.com/yui/theater/ ... rockonjs-1

Even if you've been doing javascript for years, this series is very valuable as it explains the history and evolution of the language - and should leave you with a solid grasp of how javascript works, what it is good at, and where it is going.

Once you have a good grounding in Javascript, I recommend taking a good look at jQuery. jQuery makes cross-browser javascript development much easier. It contains many essential functions for working with the DOM more easily. Moving forward, Xataface will be making extensive use of this library.

In your studies of Javascript, make sure you build a solid understanding of variable scope and closures. Javascript is unique in how it manages variable scope, and this, more than anything else, contributes to its power and potential as a language for web-based application development.