Jump to content
  • 0

Disable Fields In A Form Conditionally Using A Hidden Field Parameter


brbbrid

Question

I am passing a parameter in from a datapage form that is Yes or No.  It's just part of the user record and not an actual visible field.  But on the next form that the record information gets passed to has several fields that I am already hiding conditionally with rules based on user selections.  However, I need to disable one of the dropdown selections and all of its subsequent fields (basically forcing them to only select 1 of the options in the dropdown) if their record is marked Yes or No.  Since this is a hidden field in one table/form and is being passed to another table/form, is there a way to use the rules to disable certain fields in the 2nd form based on the value of Yes or No in the hidden field that I have to pull in to the 2nd from from the 1st form?  

 

A little background if this will help at all, in the first form, it's a search then update form, where the user gets looked up based on 2 numbers they type in, then I display their profile data and ask for a few more pieces of information.  On one of their selections in a radio button, they are directed to this next form where they can submit creative information.  On this second form it's asking for different data, and the same user can submit multiple creatives.  But only some users are eligible for certain types of creative (2), some users are eligible for both, other users are only eligible for 1 type. I am using rules to hide and show fields already depending on which type they select as I ask for different information based on the type of creative, but I need to be able to disable the 2nd type of creative and all of its fields if the user is not eligible - which is already stored in their info table.  I am passing that parameter into the creative submission form, but there is no field for it in that table because it is tied to the user id from the first table/form. So in this creative submission form, I have had to use a virtual field to pull in that eligible field and hide because I don't want them to know who is eligible and who isn't. 

 

Anyone have a way to disable fields based on a hidden field parameter?  According to page on conditional forms: the http://howto.caspio.com/datapages/forms/conditional-forms/  we cannot disable with a rule based on a hidden field....so just wondering if there is a way around this?  

 

Under a deadline, so any help on this is much appreciated!

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hi brbbrid,

 

As far as I know, you can use parameters in the Rules.

So, if you pass the parameter to your DataPage, you can select the "Parameter" item in the "Condition" field instead of "Field Name" that is selected by default.

 

I am not sure that I understand clearly what is the problem. If you need to apply two rules to one field, you can create a Section that contains only this field and apply one rule to the section and another rule to the field.

 

I hope it helps.

Link to comment
Share on other sites

  • 0

I am trying to write Javascript code to disable one of my fields, bu it is not working. This is my first year with HTML, CSS and JS and I've been at this for a couple days now and can't seem to get it to work properly. Calculated values are being inserted into the field for the users to see using Javascript, but the field itself should not allow users to input or adjust values. Here is the code:

 

 
<script type="text/javascript">
function remove() {


if(this.value == 0) {
 this.value = "";}


if(this.value == 0) {
 this.value = "";}
}


function calcFPG() {
var FPGIncome = Number(document.getElementsByName("cbParamVirtual1")[0].value);
var actualIncome = Number(document.getElementById("InsertRecordHousehold_Income").value);
var percent= 0;


percent = (actualIncome / FPGIncome)*100;


document.getElementById("InsertRecordFPG_Score").value = Math.round(percent*100) /100;
}


document.getElementById("InsertRecordHousehold_Income").value = 0;
document.getElementById("InsertRecordHousehold_Income").onfocus = remove;
document.getElementById("InsertRecordHousehold_Income").onblur = calcFPG;


document.getElementById("InsertRecordFPG_Score").value = 0;
document.getElementById("InsertRecordFPG_Score").onfocus = remove;
document.getElementsByName("cbParamVirtual1")[0].onchange = calcFPG;    <----Doesn't work or after this point


document.getElementById("InsertRecordHousehold_Size").onblur = calcFPG; 
document.getElementById("InsertRecordHousehold_Size").onchange = calcFPG; 




document.getElementById("InsertRecordFPG_Score").disabled = true;


</script>
Link to comment
Share on other sites

  • 0

Hi ugrady,

 

I have tried your Script and it works.

 

The "FPG Score" field is disabled. When I change values of "Virtual1" or "Household Income", the value of "FPG Score" is calculated.

 
What is wrong?

 

Please check names of variables.

Please make sure that you work with Submission Form, because on Single Update Form and on Details page other names are used.

Link to comment
Share on other sites

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...