PHP Classes

Sub-Forms & AJAX

Recommend this page to a friend!

      PHP Forms Class with HTML Generator and JavaScript Validation  >  PHP Forms Class with HTML Generator and JavaScript Validation package blog  >  Upcoming Visual HTML ...  >  All threads  >  Sub-Forms & AJAX  >  (Un) Subscribe thread alerts  
Subject:Sub-Forms & AJAX
Summary:Question about using sub forms with the ajax plugin
Messages:6
Author:Tarak Blah
Date:2007-02-25 14:10:00
Update:2007-03-06 07:52:24
 

  1. Sub-Forms & AJAX   Reply   Report abuse  
Picture of Tarak Blah Tarak Blah - 2007-02-25 14:10:00
Hello all,

I'm just playing around with the ajax-plugin, blew up the example with own input fields, works fine, and now I am wondering if the plugin works with sub-forms too? did anyone have some experiences on this or are there any suggestions before I start to try it by myself?

  2. Re: Sub-Forms & AJAX   Reply   Report abuse  
Picture of Tarak Blah Tarak Blah - 2007-02-26 12:37:30 - In reply to message 1 from Tarak Blah
Hello,
<br><br>
I ran into a problem using subforms with the ajax-plugin. I took the test-script "test_ajax_form.php", changed it to have 2 subforms with two submit-fields per subform and a submit-field for the whole form. Then I connected all these 3 submits to the "sender"-inputs as follows:
<br><br>
...<br>
$form->Connect("doitSub1","sender","ONCLICK","Submit",array());
$form->Connect("doitSub2","sender","ONCLICK","Submit",array());
$form->Connect("doit","sender","ONCLICK","Submit",array());
<br>...
<br><br>
Now when I click on one subform-submit, the scripts complains that the values of the other subform are missing and vice versa. Did I do something wrong? I guess so...

  3. Re: Sub-Forms & AJAX   Reply   Report abuse  
Picture of Tarak Blah Tarak Blah - 2007-02-26 12:57:45 - In reply to message 1 from Tarak Blah
I just posted this, but my browser has somehow had problems and my previous reply to this topic is not shown in the forum so sorry if you see this twice:


Hello,

I ran into a problem using subforms with the ajax-plugin. I took the test-script "test_ajax_form.php", changed it to have 2 subforms with two submit-fields per subform and a submit-field for the whole form. Then I connected all these 3 submits to the "sender"-inputs as follows:
...
$form->Connect("doitSub1","sender","ONCLICK","Submit",array());
$form->Connect("doitSub2","sender","ONCLICK","Submit",array());
$form->Connect("doit","sender","ONCLICK","Submit",array());
...
Now when I click on one subform-submit, the scripts complains that the values of the other subform are missing and vice versa. Did I do something wrong? I guess so...

  4. Re: Sub-Forms & AJAX   Reply   Report abuse  
Picture of Tarak Blah Tarak Blah - 2007-02-27 13:28:30 - In reply to message 1 from Tarak Blah
I seriously don't know what happened with my reply I posted to this thread... I re-posted it again and the second post is not shown either. If I have messed things up, I want to apologize in advance... I hope this post will be displayed though... Tarak P.S.: I was having html-br-tags in my post, the preview displayed them, but then... Was that the mistake? Hmmm... If yes, I wonder why the preview displays them correctly...

  5. Re: Sub-Forms & AJAX   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-02-27 15:05:31 - In reply to message 1 from Tarak Blah
Currently, the sub-forms feature is only triggered when a submit button is clicked to trigger normal form submission.

The AJAX forms submission may be triggered by any actions or events, so it is not associated to any sub-form.

I may add a new action parameter to connect to any other input so the sub-form is set when the AJAX submit action is executed.

On the server side it is also not possible to determine which submit button was used when you connect the AJAX submit action to input ONCLICK event, as the server does not get the request variable of the submit input set.

Figuring which submit input button was used must be determined some other way, like for instance using the SetInputValue parameter of the submit action to set a special value of an hidden field.

  6. Re: Sub-Forms & AJAX   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-03-06 07:52:24 - In reply to message 5 from Manuel Lemos
Sub-form validation was just implemented for AJAX form submission. Just try the latest version.

You just need to specify the name of the sub-form to validate with context argument SubForm of the Connect function. On the server side, the sub-form is passed as the message parameter SubForm, if a sub-form was specified to the Connect call that triggered the form submission action.