rafavro Posted March 1, 2011 Report Share Posted March 1, 2011 On a details datapage, updateable fields (for example a caspio Text element) are referenced with JS using document.getElementById ("EditRecordfield").value; What JS should be used if the field in question is a caspio Display Only element ? What JS should be used if the field in question is a Hidden element ? Thanks for your help. Quote Link to comment Share on other sites More sharing options...
ChrisJ Posted March 3, 2011 Report Share Posted March 3, 2011 For the hidden form element the JS is the same as for text field: I.e. your example is OK: document.getElementById ("EditRecordfield").value; As for Display only form element, it has difficulty, because it doesn't have id. I see, the HTML code on details page for the Display only is like the following; Your_unique_label Your_value Think you need: 1) make sure the label for it is unique through the whole details page 2) Get all the 3) Get the value of tag of this element Quote Link to comment Share on other sites More sharing options...
ChrisJ Posted March 3, 2011 Report Share Posted March 3, 2011 Have developed this function. The following code is to be paste to details page footer: --------------------------- function i_TR() { var TRTags = new Array(); TRTags = document.getElementsByTagName('tr'); var tempInnerHTML; var tempInnerHTML2; var SPAN_value = "NOT_FOUND"; var StartIndexOfSpan; var EndIndexOfSpan; for (i=0; i { tempInnerHTML = TRTags.innerHTML.toString(); if (tempInnerHTML.indexOf('Your_unique_label') != -1) { var TRTags2 = new Array(); TRTags2 = TRTags.getElementsByTagName('tr'); for (j=0; j { tempInnerHTML2 = TRTags2[j].innerHTML.toString(); if (tempInnerHTML2.indexOf('Your_unique_label') != -1) { StartIndexOfSpan = tempInnerHTML2.indexOf(' EndIndexOfSpan = tempInnerHTML2.indexOf(' '); SPAN_value = tempInnerHTML2.substring(StartIndexOfSpan + 25, EndIndexOfSpan); return SPAN_value; } } } } return SPAN_value; } Alert --------------------------- Here I use Then I read the content of tag and return result. Pay attention. In case you have several labels like 'Your_unique_label3', 'Your_unique_label', 'Your_unique_label2', this will lead to incorrect results. So, your label should be really unique to use this method. I also see that value can referenced via HTML block parameter. viewtopic.php?f=3&t=12518 Not tried this yet. 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.