on 08-25-2011 2:15 AM
Hi,
I need to hide a certian field in the form based on value in another field, I used Javascript for this and the code is below. The form will have multiple pages and the field thats need to be hidden is hidden only in the first page and not others. Please suggest what needs to be done to correct this. I am also not sure in which event i have to use this code. Now I am using it in Initialize event.
var lines = data.Subform1.DATA.LINES;
for (var curpage=1;curpage<=lines;curpage++)
{
if (this.rawValue = 'AD') {data.Subform1.DATA.REFNUM.presence = "hidden";}
if (this.rawValue = 'FR') {data.Subform1.DATA.ZREBZG.presence = "hidden";}
if (this.rawValue = 'SS') {data.Subform1.DATA.ZREBZG.presence = "hidden";}
}
Rakesh,
Issue could not be solved, going with both fields on form for now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Rakhi,
Id: 346-085-050
Login: go.mikogo.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Rakhi,
Id for Mikogo, 751-167-424
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Rakhi, I don't have mikogo. I will install it and send u id soon.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, Still doesn't work...Is there any other way to hide the fields?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This code has to be placed in the calculate event for the page right?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, It did not solve my problem. I see both fields ZREBZG and REFNUM overlapped on all pages.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Rakhii,
AD, FR, SS are values of a different field. I overlapped ZREBZG and REFNUM. The field which containds AD, FR, SS are at a different place on the form. I hope your code works in that case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Kiran,
The code which you wrote will acess every time the field in first page. Please try this code in calculate event and let me know if you see any issues. This will compute values for each page dynamically
var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);
for (var i=0; i <= fields.length-1; i++)
{
if (fields.item(i).name == "REFNUM")
{
if(fields.item(i).rawValue == 'AD')
this.presence = "invisible";
}
if (fields.item(i).name == "ZREBZG")
{
if(fields.item(i).rawValue == 'FR')
this.presence = "invisible";
}
if (fields.item(i).name == "ZREBZG")
{
if(fields.item(i).rawValue == 'SS')
this.presence = "invisible";
}
}
Make sure that the field names which you are going to make invisible are not used anywhere in the form.
Please let me know, if you see any issues.
Thanks,
Rakesh
Edited by: rakhi966 on Aug 25, 2011 6:44 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Hendrix,
I am using this script in the initialize event for the field which controls the appearance of ZREBZG and REFNUM. What ever I do only the fields on the first page are being hidden. Are you suggesting to code events for the fields ZREBZG and REFNUM instead of the field which controls the appearance of these fields?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Kiran,
In the initialize event the data might not available yet.
You can use the events for the REFNUM and ZREBZG field and make a condition just the other way around.
Hope this helps.
Cheers,
Noel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.