web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Conditionally predefau...
Power Pages
Unanswered

Conditionally predefault choice/dropdown column

(0) ShareShare
ReportReport
Posted on by 323

Hi,

 

We have a dropdown/choice field on a basic form. We have passed a URL parameter to the page and in the Additional Settings of the Basic Form, we have added the following code.

prathyoo_0-1708602106750.png

 

  var regType = '{{ request.params.evttype }}'; $("#dgccso_registrationtype").val(regType).change();  

The code works and the correct value shows up on the form. When the form is submitted, the value that was assigned to the column is correctly updated on the record that is created.

 

But, we want to either hide this form field or make it read-only. But, when we do that, the column value is not updated in dataverse -

prathyoo_1-1708601639182.png

The first record is where we tried to disable the column on the UI by using the following JS - 

 

 $("#dgccso_registrationtype").attr("disabled","disabled"); 

 

We also tried making the column read-only on the dataverse form (not the portal basic form). Again, the column becomes blank even though we have predefaulted it via code.

 

We also tried removing the column from UI using JS and again after removing from UI, the field does not get update when the form is submitted but becomes blank instead.

$("#dgccso_registrationtype").remove()

 

What is the way to have the column read-only/hidden but yet updated on form submission?

  

 

 

 

 

 

Categories:
I have the same question (0)
  • Fubar Profile Picture
    8,346 Super User 2025 Season 2 on at

    First, if the field is Readonly on the in Dataverse Form, then it will not update back.

    To hide it.

     

    $("#field_name").closest("td").find("div.control, div.info").hide();

     

    The above is from @OliverRodrigues Some other show/hide by Oliver here https://oliverrodrigues365.com/2020/07/19/power-apps-portals-javascript-tip-01-hide-show-elements/

     

    Can't remember if this will work or not, but try making the control readonly (rather than disabled), see the "Set Dropdown ReadOnly" on this other page by Oliver https://oliverrodrigues365.com/2020/08/16/power-apps-portals-javascript-tip-02-set-attributes-read-only/

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 70 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 55

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard