Conditional activation of a form field

Creating and using forms

Conditional activation of a form field

Postby calstreet » Tue Jan 08, 2019 9:02 am

I am trying to create a form for customer profile for which I need to capture if the person married or not based on which a form field with the spouse name should be activated in the form. anyone has any idea on how to achieve this.
Libraoffice 6.1.4.2 on Windows 10
calstreet
 
Posts: 1
Joined: Tue Jan 08, 2019 8:56 am

Re: Conditional activation of a form field

Postby UnklDonald418 » Wed Jan 09, 2019 10:39 pm

To do that requires coded macros. The code to hide or un-hide a form control isn't terribly complex, but it must be modified for that particular form. If you are familiar with writing OO macro code then here is the basic code to Hide and Unhide a form control. Of course it will need to be modified to work with your particular form, and you will need to find appropriate events to trigger the macros.
Code: Select all   Expand viewCollapse view
REM  *****  BASIC  *****
Sub HideControl ( oEvent as object )

  Dim oControl

  oControl = oEvent.Source.Model.Parent.getByName("Control Name Goes Here")
  oControl.setPropertyValue("EnableVisible", False)

End Sub

Sub UnhideControl ( oEvent as object )

  Dim oControl
 
oControl = oEvent.Source.Model.Parent.getByName("Control Name Goes Here")
oControl.setPropertyValue("EnableVisible", True)

End Sub

If you are not familiar with coding macros in OO the learning curve is quite steep.
Andrew Pitonyak has a book that covers OO macros, and another document devoted to Base macros.
http://www.pitonyak.org/oo.php
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.6 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1083
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA


Return to Forms

Who is online

Users browsing this forum: No registered users and 1 guest