424
Views
3
Comments
Solved
Disable/enable Form with javascript

Hi,

I've been working with Outsystems in the past few days and i'm struggling with javascript

I have a form with all the fields disabled and i want to add a button to enable all those fields so user can edit what he wants.

The button has the extended property onclick with:

SyntaxEditor Code Snippet

"jsChangeToEdit(); return true;"


My question is what do i put in my getElementById

SyntaxEditor Code Snippet

function jsChangeToEdit(){
document.getElementById("what to put here").disabled = false;
}

Thanks in advance


2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

Hi Jorge,


maybe first the naieve question : why not use an Ajax Submit Action with an Ajax Refresh of the entire form ?


But if you want to go the Javascript route, you can't hard code the id in your Javascript because they get generated by the platform later on, they are not known yet at design time.  

But you can refer to that id for all elements that you have given a name as <ElementName>.Id:



UserImage.jpg
Jorge Desirat

Hi Dorine,

I'd follow your advice with ajax submit and worked flawlessly.

Ty so much.

Best regards

2021-09-06 15-09-53
Dorine Boudry
 
MVP

My pleasure Jorge,

can you mark answer as solution, I am an enthousiastic collector of green borders :-)

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.