• Hi there,

    Firstly thank you for your awesome plugin. I’ve been using it for well over 4 years and find it absolutely superb for my website requirements.

    This is quite an embarrassing question as I’m sure it’s simple Javascript.

    I’m trying to create very simple button(s) for my Single Record page which will allow users to navigate to either the previous record or the next record. I’d probably use the “Record ID” as the query and then simply minus 1 or plus 1 for Previous and Next records.

    At present I’ve added a “Back to previous page” button using a basic html form with an onclick=”history.back() function.

    Rather than users having to return to the main pdb-list page and select the a previous or next record I was hoping there is a way of easily adding this functionality on the single record page (using buttons which I can style via CSS).

    Thanks for any suggestions or code that would allow this. I’ve done some searching on the subject but unsure where to start and which route to take.

    Any help much appreciated.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author xnau webdesign

    (@xnau)

    It is best to do this with php in a custom template for the single record shortcode.

    In your custom template, you will need to include code that determines the id of the next and previous records. This should happen at the top of the template. This is not as simple as adding or subtracting from the current id because it would be normal for there to be skipped ids (when records are deleted). So, you will need to query the database to make sure you have valid ids.

    Once you have those two id numbers, you can use them to build the next and previous links, and then add them to the template where they can be displayed.

    There isn’t any built-in way to do this because it’s not a thing most Participants Database administrators need, but given some skill with php it is not difficult.

    Check this function for a way to get a list of ids from the database:

    Participants_Db::get_id_list( )

    Thread Starter KJW2912

    (@kjw2912)

    I’ll have a look at this. Thanks for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Previous / Next Record Button’ is closed to new replies.