Cannot get value with propertis hidden or display only

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

juned_seskoad
Ebase User
Posts: 35
Joined: Mon Jul 14, 2014 11:55 pm

Cannot get value with propertis hidden or display only

#1

Postby juned_seskoad » Fri Aug 15, 2014 7:08 am

Dear All,

Why I can not get value from Field or Text if I set properties as Display Only or Hidden.

Sample:
I have treeview, Field_B value is from treeview Node:
function setNode(parentId,childId,parentName,childName,menuMap){
$('.Field_B_class').map(menuMap);
}

field_B set as Display Only or Hidden, then I want to check Field_B value by display it on Field_A

document.getElementById('field_A').value = document.getElementById('Field_B').value;

result is Field_A will Blank (no value) , but if field_B not hidden/not display only, field_A will get field_B value

Regards

Juned
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Fri Aug 15, 2014 1:52 pm

Juned,

If it's hidden, then Ebase will not include it on the page so you can't check it. If you want it to be both hidden AND included on the page you should use css "display:none;" instead of the control hidden attribute. You can set this in the designer by clicking the Advanced Properties button within each control's styling assistant.

If it's display only, then your document.getElementById() method is going to return the HTML element containing the field value - in this case it will be a <span> tag (I think) whereas if the field is editable it will be an <input> tag. My point is that the Javascript object returned for the span tag probably doesn't have a value property which is why it doesn't work. You might need to use the textContent property instead. Alternatively, use jQuery instead of native Javascript - jQuery has val() and text() methods.

Hope this makes sense.

Jon
0 x

juned_seskoad
Ebase User
Posts: 35
Joined: Mon Jul 14, 2014 11:55 pm

#3

Postby juned_seskoad » Mon Aug 18, 2014 7:09 pm

Thanks Jon, It help me

Regards

Juned
0 x


Who is online

Users browsing this forum: No registered users and 22 guests