This topic is locked

Javascript inline row limit

7/14/2019 6:10:39 AM
PHPRunner General questions
A
AndrewMark author

Hi,
I have an inline child table that currently allows unlimited amounts of records to be added. I would like to restrict the number of inline adds the user can make to 10. However I want to do this at the Javascript level. So once the user has 10 rows created (via the inline add button) they cannot create anymore.
I have seen the topic https://xlinesoft.com/phprunner/docs/limit_number_of_records_users_can_add.htm. However this manages the add limits at the server level, I need to do this at the client level - hence the need to do it in Javascript.
Does anybody have any experience in this in PHPRunner?

admin 7/15/2019

You can move that code from BeforeAdd event to BeforeProcess event of the Add page. Instead of return false; you will need to do exit();
It won't look good from UI point of view as that 'Inline Add' button still be available, just won't do anything.

A
AndrewMark author 7/17/2019

Thank you for your response . Unfortunately still can't get it to work. The code completely restricts any adds, not just the set limit. I will keep trying.