This topic is locked

Disable Add Button based on field value in Master Table

9/20/2008 11:56:24 AM
ASPRunnerPro General questions
D
dgrayson author

How can I disable the add button on the list page of a child table based on a value in the master table, (not the key field).
Thanks for any help you can give me. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=9578&image=1&table=forumtopics' class='bbc_emoticon' alt=':blink:' />

Sergey Kornilov admin 9/23/2008

As a first step, you need to save a value from the Master table in Session variable.
Then on the details list page you can use "Insert ASP code snippet" function where you can use something like this:

if Session("SavedValue")<>"" then

Response.write "<script> $('input[@value="Add new"]').get(0).disabled = true; </script>"

end


You can also completely hide "Add new" button:

if Session("SavedValue")<>"" then

Response.write "<script> $('input[@value="Add new"]').hide(); </script>"

end