Form Action=Post
Form Action=Post
XstreamINsanity
Posts: 23Questions: 0Answers: 0
My issue is that I have records and controls being created on the fly which mean the names and IDs are as well. I'm doing server-side processing and right now only returning 10 records at a time. If I define a form tag on the table, it only returns to me the first records information (I can't search by element as the ids are dynamic). I want to put a form tag on each row, but after looking at the javascript, I don't think it's possible. I say that because it take the JSON data and makes an element (TD) for each value in the record. If I put the opening form tag in one element and the closing in another, that violates HTML rules (the parent element may not be ended before thei child's element). Is there a way to add a "form action=Post" to each row already that I'm just not aware of, or will I have to modify the javascript some? Thanks for any help.
This discussion has been closed.
Replies
Looking at the js file, it looks like in the _fnGatherData(oSettings) function is where you loop through the elements and put them to the TD elements. Where in there would I be able to say (psuedocode since I'm not too familiar with javascript) "if the td value contains '
Allan
if (aData /*Contains or however you do that*/ "
[code]
<!ELEMENT tr (th|td)+>
[/code]
Allan
P.S. Also, if I put an alert("Hello"), as long as the code gets to that point, I should see a window pop up, right? I ask because I'm trying that now and getting nothing. Thanks.
[code]
...
...
...
[/code]
which is what it sounds like you are looking for, is not valid HTML. The form tag could probably go into the TD elements, but again, that doesn't sound like what you want. Since you are using Javascript though, one option would be to read the values from the row where the submit button was pressed, put them into a form dynamically and then submit that.
Allan
[code]
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
[/code]
I'm not sure if it would work in normal code and if it does how, but I know in MVC2 when you say FormCollection, it gets the form items from the form that did the post back and nothing else. I don't know, I got all of this from stuff my coworkers were doing and looking at their HTML source after rendering the page, but since I'm in charge of working on the dataTables, they wanted me to find out how to use Server-Side processing and still be able to use the form. Since in the view I'm not iterating through objects, I can't put a form tag and dynamically change it's name. Right now, I have four controls per row; 3 drop down and 1 button. The only control that does a post is the button. It is to get the values from the three drop downs and use them to determine what SQL Update statement to run. If we wrote the view with client-side processing on the dataTable, then we'd have the form tag around the controls (not including the other 8 columns, they can be out of the form tag) and dynamically set the tag name. That is what worked. When we had issues with too much data and needed to use server-side processing, we lost that functionality. Now, if I update the first record in the table, it all works fine (well, the way I had it yesterday morning, much has changed since then). But they need to be able to update any record in the table. And we're trying to do it where each row has it's own controls, not any master controls. I do appreciate your help and hope all is well.