I have table rows of data in html being filled from a CGI application. I want each row to have a check box next to it so I can delete multiple rows, just like in gmail.
I figured out the basic text form and was able to send it to the CGI program to delete the row, but I don’t want to have to type in the row name to delete a single file at a time.
What does the code look like on both sides (html-browser and C-CGI app) for forms when you can select multiple deletions through check boxes? Is there an example somewhere? (I am limited to JS and HTML but I think JS is for validation anyway, don’t need that right now. C coding on the CGI app side.)
Thank You.
Well, you could do it in a few ways:
1) Have all elements in the same form. Name each checkbox the same but give each checkbox a value that distinguishes the record/id/file it represents. When the browser, if it is compliant, submits the form, the CGI app should be able to see the HTTP parameters as part of the POST or GET submission. Lots of CGI apps like PHP combine same-name parameters into an array. You can always walk the param list yourself with C as well.
2) Using AJAX and preferrably some type of Javascript library, when user clicks delete, perform an ajax-based submission that submits a request to delete the checked records. Simultaneously use Javascript to remove the rows from the HTML table. This means the user’s page is never fully refreshed, well, sort of.