cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Fields In Read- Only Mode

vipin_v2
Participant
0 Kudos

Hi,

I have developed an interactive form which has 'x' input fields, 'y' radio buttons and one submit button. The requirement is such once user fills up the whole form and clicks on submit button, 1) the filled in form should get mailed to helpdesk group with all the 2) input fields and radio buttons in readonly mode and submit button in invisible state.

Requirement 1 has been implemented and is working fine but i am not sure on how to achieve the 2nd requirement. I have read that using inputfield.access = "readOnly"; we can get the field in readonly mode but i have tried it but isn' t working. I think i am going wrong some where on this.

It will be of great help if some one can let me know on how to achieve the 2nd requirement.

Thanks In Advance,

Vipin.

Accepted Solutions (0)

Answers (4)

Answers (4)

OttoGold
Active Contributor
0 Kudos

Did you solve the problem? Or what was the result back then? Otto

vipin_v2
Participant
0 Kudos

Yes Otto,

I was able to solve my problem.

1) I added an input field to the form which will get into invisible state once the form loads in as a result user will never know that there exists an additional radio button in the form. In the properties object of radio button added a value as '1' so that when ever this radio button is selected it will have the value as '1' and by default it' s value will be null.

2) In every other remaining fields i am checking whether the value of this radio button is '1' or not, if yes then the fields access is readonly.

3) In the properties of Submit button too i am checking whether the value of this radio button is '1', if yes then the button will go invisible.

Now, on click of the submit button i am changing the value of added radio button to '1' using rawValue property and as a result the remaining fields go into readonly mode and the submit button goes into invisible state, and this will be sustained even in the form which gets delivered via mail as a pdf successfully.

With Regards,

Vipin.

OttoGold
Active Contributor
0 Kudos

Hello,

did you try to call the set-read-only-function after the external event call once more? Maybe this simple trick can work? I don´t see a reason why not.

In the other library folders there are some other useful components to make something read-only - tab WD Native: Sinature Sign and lock. You can try to place this on the form (if that is permitted for your task) or try to "hack" the code implemented here and use it to lock your fields this way.

Otto

vipin_v2
Participant
0 Kudos

Hi Otto,

Thanks for your valuable suggestion once again.

If i want to run the read only function to get my fields in read only mode once again after the external event has beeen trigered then where exactly should i place the java script code.

 var objContainer = Value_Node.rename;
 
// call the method to set all fields to read only (recursion)
disableAllFields(objContainer);
 
function disableAllFields(objContainer) {
	for (var i=0; i < objContainer.nodes.length; i++) {		
		switch (objContainer.nodes.item(i).className) {
			case "field" : 
			case "exclGroup" :
				objContainer.nodes.item(i).access = "readOnly";
				break;
 
			case "subform" :
				disableAllFields(objContainer.nodes.item(i));
				break;
 
			default:
		}
	}
} 

I tried placing the above code after

 ContainerFoundation_JS.SendMessageToContainer(event.target, "submit", "", "", "", "");

inside click event of submit button but it unforutunately doesn' t work as i expected.

Appreciate your help on this.

Thanks in Advance,

vipin.

OttoGold
Active Contributor
0 Kudos

Or check the following forum threads:

Otto

vipin_v2
Participant
0 Kudos

Hi,

Thanks Otto for providing me an useful link!

Now i am able to get my fields in readonly mode but there is still something which is not complete. What i have done is, i have taken a button of type button from the library and in it' s click event have added the javascript code to get the fields in readonly mode, and it works fine.

But the real problem here is apart from running the javascript code the button does not run the external event (to save data and triger mail) which i have implemented in another action.

To solve this i took a submit button in the form which does the external event and a button of type button which will run the javascript code to get the fields in the readonly mode and have made the submit button invisible and using javascript code i am executing both buttons in single click.

The flow is first the fields get into readonly mode and later the external event, here the intersting factor is intially the fields get into readonly mode as required but when the external event gets trigered the fields are getting back into it' s intial mode.

Can anyone please let me know how to maintain the readonly event even after the external event has been trigered.

It will be of great help as iam in very much need of it.

Thanks a ton in advance,

Vipin.

OttoGold
Active Contributor
0 Kudos

Hello,

I guess you were successful with hiding the button right? So only the locking remains, right?

Maybe you can paste here your code so we can check if there is a syntax error or some other problem.

Regards, Otto