February 9th, 2013, 04:25 PM
Form submission would not work correctly
I got a special problem which is caused by several forms being displayed on a page by ajax.
Now each of these forms has the same input fields and is processed by the same script. This is how such a form would look alike:
form onSubmit="ajaxRequest('ajax.support.php\, 'POST', '', 'supportAnswer', ['notification'], ['/images/ajaxLoader.gif']); return false;" method="post" enctype="application/x-www-form-urlencoded" name="supportAnswer"> <div class="row3 clearfix"> <div class="sender">Antworten:</div> <div class="message" style="margin-top:0px;margin-bottom:0px;padding-right:0px;padding-left:0px;"><textarea name="message" style="width:491px;height:140px;border:0px;padding:5px;"/></textarea></div> </div> <p style="clear:both;padding:9px"></p> <div class="text clearfix"><div class="right"><input type="hidden" name="id" value="211" /><input type="hidden" name="postId" value="1356" /><input type="hidden" name="do" value="sendAnswer" /><button type="submit" style="width:144px; height:25px; vertical-align:top;">Senden</button></div></div> </form>
Now the problem I have is, that if there is e.g. 3 forms displayed, no matter which form I hit the submit button it seems that all the time there is sent every field in EVERY form (and not just the one i submit)...
To give you an example e.g. firebug would show that as being sent by POST:
Can anyone explain to me how this happens? And more important how I can prevent it? Just to say that forehand, I cannot name the fields in each form a different way since these are fields for the same kinda process that is done by ajax.support.php
Would be thankful for any help I can get.
February 9th, 2013, 05:16 PM
we need the definition of ajaxRequest. Obviously this function doesn't fetch the values correctly. Could be a selector issue or something, but we can't tell without the exact code.