Jump to content

Button to Change Field Value Similar to Radio Boxes


This topic is 2843 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a layout that is being designed for use on an iPad, and have a value list for a record type.  For a desktop implementation, I would use radio boxes to choose the value.  However, they are too small for what I need for the iPad.  I would like to create a button that acts like a radio box, most likely based on scripting, however my attempts at doing so with SetField have not worked.

Is what I am attempting to do possible, and if so, any pointers on correct programming for these buttons?

Edited by rekent
Link to comment
Share on other sites

I suggest you upload a very simple file that demonstrates what you are trying to do; including the script that you attempted.

Link to comment
Share on other sites

Attached is a basic demo file.  Essentially I want the large buttons on the right to function like the radio boxes on the left (in essence giving me supersize radio boxes).  However, the SetField script is not changing the field value to the text strings that I specify.

Demo.fmp12

Link to comment
Share on other sites

This is all about learning how to properly use the Set Field script step; and the various parts of this script step.

See attached screen shot and modified file.

It is really helpful to do provide an example, as you have done. It lets us see the details of how you have attempted things.

Set Field.png

DemoMOD.fmp12

Link to comment
Share on other sites

Much better, and much appreciated!  It has been years since I have touched Filemaker and I knew that I was missing something - I was trying to both select the field and set the value from the calculate step rather than two separate ones.

Thanks for the assist!

Link to comment
Share on other sites

A follow-up question, BruceR.

My file has two views: a thumbnail view, and the individual record view where the buttons previous described are located.  I wanted to include a single additional button on the thumbnail page that toggled between the two values, regardless of what they are.  

In the attached Function Demo, when you click the toggle, the button works properly and as expected, and the status immediately changes.  In the attached Production Demo, which is made from the actual file I am working in, you have to click the button and then click anywhere else in the layout other than on the button before the status will change.  The script coding is the same for both.  In the Production Demo, the button is located on the Thumbnails page underneath the words "New Content".

Production Demo.fmp12

Function Demo.fmp12

Link to comment
Share on other sites

"you have to click the button and then click anywhere else in the layout"

You need to add a commit record statement after the set field statement.

  • Like 1
Link to comment
Share on other sites

Thanks again.  That makes sense and fixed it, but I found a new problem as a result.  No matter which record I choose (e.g., New Content [2] through [5] in the attached), only the first record is changed (when using the "Toggle Type" script).  It looks like I may have to rethink this entire functionality, unless there is a modification to the code that will take the values of the particular repetition being clicked on into account. I know that I can user Get(ActiveRepetitionNumber) to determine which repetition I am clicking on, but when I try to integrate that into the script (using the "Switch Type" script) then the status change functionality no longer works (it looks like the Get function is always returning zero).

Production Demo.fmp12

Link to comment
Share on other sites

Well; that's a solvable problem.

But why are you using repeating fields? 

Generally, they should be avoided, in favor of having related child records.

Link to comment
Share on other sites

Quite frankly, it was initially for the sake of simplicity.  I began with one of the starter solutions because this was just a little project for personal use and I didn't want to mess with the visual layout too much,  But, as I tested it out I began changing a significant amount and adding functionality, it has ballooned into something that probably is not well suited to have a starter solution as its base.

 

Link to comment
Share on other sites

I plan to keep trying to improve it to function like I am hoping, but ultimately it is merely a hobby database that several people I know have asked me to share with them because they like the idea and that I will continue to use to get back into Filemaker and relearn more of it.  Which is to say, probably not worth any more of your time since it is not a serious thing.

Link to comment
Share on other sites

Ok, that fixes the functionality that I was going for here. It looks like I at least had the right basic idea in incrementing my buttons for each repetition, but my implementation was off because I hadn't thought to set it as a variable.  It also emphasizes an area that I need to work on because it touches on the aspect of Filemaker that I was always weakest on: Relationships and when/how to use them.

Now all that is left is a strange bug that I am trying to track down.  When zSort Selection is one value, the layout updates properly based on the Switch Type script, but when zSort Selection is a different value, the layout does not update properly.  I've gone through the scripts looking for any use of zSort Selection that could be altering the results, but haven't found one, so it looks like it will just require more hunting and experimenting.

Link to comment
Share on other sites

This topic is 2843 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.