adding form fields at runtime?

antonio
Posts: 77
Joined: 2010-09-28 11:48

adding form fields at runtime?

Post by antonio » 2011-11-18 18:00

Hi all,
I'm using ADDT here, but I think this is the same in Kollection 3 pro.

I need to create a form with a X number of fields.

Something similar to:

---------
MYFORM
field1
field2
field3
---------
[submit]
[add field(button)]

After clicking the add field button the field4 is created. So the form will look like:

---------
MYFORM
field1
field2
field3
field4
---------
[submit]
[add field(button)]

I found a way to do this with javascript but after I create all required fields I cannot find a way to manage them with ADDT.

I have the number of total fields in a Javascript variable.

I cannot find an easy way to pass this variable to php for handling with ADDT validation and session storing. I would like to store all fields in session variable and collect them.

It seems I need to send the javascript variable doing a redirect but how can I manage it with ADDT?

Hope someone can help me.

Thanks in advance for any suggestion.

tony

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: adding form fields at runtime?

Post by Fred » 2011-11-24 10:24

Is the page updating a database on submit?

jtbarnes3rd
Posts: 2
Joined: 2011-11-29 00:33

Re: adding form fields at runtime?

Post by jtbarnes3rd » 2011-11-29 01:20

I'm using the ADDT also. I'm not sure if it's what you are looking for but I'm using the latest Spry Toolkit utilities "Submit forms with XHR"

http://labs.adobe.com/technologies/spry ... e.php.html

I have a radio group (SpryValidationRadioGroup dynamically created from a database table) when changed I want to submit the document --- each input tag I add onchange="document.getElementById('accounttype_form').submit();
but I only want the next autocomplete text data to be updated so I add to the form tag --- action="#" onsubmit="Spry.Utils.submitForm(this, updateResponseDiv, {method:'post'})" Within the form I check the post variables to update the query that the ADDT autocomplete uses. For your purposes I think I would just have a file I would update containing the fields and include that in my form. The add button I would use to write to the included file and submit the form. This way I'm not writing to the same file my button control (and probably other controls) is in. This is the only way I could figure out how to read which radiobutton on any other Adobe control was selected/modified and update another control based on this change (even though the displayed state changed.) If somebody else knows an easier method, please post it. The only problem I'm having with this implementation is how different browsers handle the cursor keys from within the autocomplete text box. I'll post this question in a different forum.

Post Reply