Hello,
I would like my users to be able to add multiple links in one form and choose categories using selection. I have modified the add.pm and some template files and almost got there. Users first choose how many links to add, then a add form with that number of entries will be displayed. The problem I have is the not_null check by db->add.
After submission, I put all input links in a hash ref and then add each link into database through a loop. However, if some link in the middle of the hash gets a blank field that should be not_null, and the db->add returns a error and a add_error page is returned, you can not just simple go back to correct the error and resubmit because there are links that have already been added to the database. If you resubmit, you will get duplicate links. My question is
Should I check the completeness of submission using my own code before calling db->add?
Or is there any db method to test not_null before actually db->add?
Or is there any better strategy for this?
Thank you in advance.
Long
I would like my users to be able to add multiple links in one form and choose categories using selection. I have modified the add.pm and some template files and almost got there. Users first choose how many links to add, then a add form with that number of entries will be displayed. The problem I have is the not_null check by db->add.
After submission, I put all input links in a hash ref and then add each link into database through a loop. However, if some link in the middle of the hash gets a blank field that should be not_null, and the db->add returns a error and a add_error page is returned, you can not just simple go back to correct the error and resubmit because there are links that have already been added to the database. If you resubmit, you will get duplicate links. My question is
Should I check the completeness of submission using my own code before calling db->add?
Or is there any db method to test not_null before actually db->add?
Or is there any better strategy for this?
Thank you in advance.
Long