aam82 Posted March 29, 2016 Report Share Posted March 29, 2016 I found that I can hide table elements based on HTML5 data attribute values. This solves a shortcoming of Caspio datapage configuration options: If you have a datapage that uses Inline Insert, you will find that you must choose between allowing a field to be editable on Insert, and allowing a field to be editable on Edit. In my case, I wanted to allow Inserts with a date, but once the record was there, I didn't want the date to ever change. When you enable Inline Insert, you don't have this ability, because if you disable editing the date, then one can't Insert new records with a date. However, a unique HTML5 data attribute=name, value=InlineEdityourFieldName is only applied to rows opened for editing, not on the Insert row, so we can use the attribute and value combo as a css selector to target Edits and not Inserts. Here I add the class "hideDateEdit" to matches for my selector, then inline a style to hide that class. Actually, I'm adding the class to the parentNode of my match, so that the contents of the whole cell are hidden, in this case, the date's text input, as well as the adjacent calendar img for the popup calendar function. <SCRIPT LANGUAGE="JavaScript"> var elems = document.querySelectorAll('input[name=InlineEditDates_Date]'); for (var i=0, m=elems.length; i<m; i++) { elems.parentNode.className = "hideDateEdit"; } </SCRIPT> <style type="text/css">.hideDateEdit { display: none; } </style> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.