Jump to content

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

Recommended Posts

Posted

Having dug around in my manuals and other help texts, and probed the WebTools help, I'm still stuck so would love some help on the following:

I have an editable record_detail page that currently returns an "x" or nothing in a text field, depending on the value of the field in the database. To make it easier to the user, I'd like to turn the text fields into checkboxes, but want them to show the current value (empty or full) of the related field in my database. I can't seem to figure out the syntax for entering a checked checkbox into my format page, but I'm sure there's a way to do it.

Any ideas?

Thanks in advance.

Peter Knowles

Posted

I'm not sure this is exactly what you are asking for, but I have had good success using the following:

[FMP-ValueList:MyFieldName, List=MyListofChoices]

<input type="checkbox" name="MyFieldName" Value=[FMP-ValueListItem]" [FMP-ValueListChecked]>[FMP-ValueListItem][/FMP-valueList]

This will display all of the choices specified by your valuelist and show the user which have already been chosen. If you want to restrict the user to only one choice, use type="radio" instead of type="checkbox". Of course, you have to define a valuelist containing your list of choices, specify your database and layout, etc.

By the way, this will allow updating of the record only if it is located within a form. On a reply page where it isn't sandwiched between <Form... and </Form> it will look like it is updateable, but it doesn't actually allow the user to change the database.

HTH!

Posted

To sbk (and anyone else)

This solution looks like it requires the checkboxes to be connected to a valuelist in the database. That's not how I'm currently handling the different data I'm trying to manage.

Currently I have a number of different fields (45 or so) which can each be empty or "X'" depending on an initial checkbox selection from a new records page: (A series of <INPUT TYPE=checkbox NAME="Fieldname" VALUE=X> codes on the page new.htm is how those X s got there) . So in my database, each of these 45+ fields is either empty or X, and I want the record_detail page which is returned on a search to show with a checkbox that the field is empty (unchecked) or X (checked).

sbk's solution looks promising, but do I need to reconfigure the way I set up my initial data input? Do I need to create a valuelist based on existing fields? I'm not sure if my initial db design precludes all these good things from happening. A little more detail would be great!

Thanks again

Peter Knowles (just upstream from you, sbk, in Washington)

Posted

You can use the [FMP-If] tags to achieve this. For example:

[FMP-IF:myfield1.eq.x]

<input type="checkbox" name="myfield1" checked>

[FMP-Else]

<input type="checkbox" name="myfield1">

[/FMP-If]

[FMP-IF:myfield2.eq.x]

<input type="checkbox" name="myfield2" checked>

[FMP-Else]

<input type="checkbox" name="myfield2">

[/FMP-If]

The only hassle now is how will the changed values be written back to the database.

All the best.

Garry

Posted

Yes, you would have to change your database design to use the solution I provided. And, I went through that myself. I had multiple programs that I wanted to have checked or unchecked. I found that using the same field with a valuelist is actually the better way to go. You can set up your valuelist based on field entries or a set list.

GARRYCL provided a nice solution. Before I changed my database, I used the following solution to provide checkboxes (or radio buttons) to both display the current value and allow the person to edit the data.

First, I set up a ValueList called YesNo, and populated it with the values of "Yes" and "No". I then used this same valuelist for each of my fields, basically using the same coding as I provided earlier for each field you want to display. If you use this method, make sure that when you copy and paste the coding, you change all references to the field name.

Good Luck! Hope this isn't too confusing!

Posted

BTW - to display the correct name for each field, you would need to modify the code as follows:

[FMP-ValueList:MyFieldName1, List=YN]

<input type="checkbox" name="MyFieldName1" Value=[FMP-ValueListItem]" [FMP-ValueListChecked]>[/FMP-valueList]Display Name for Field 1

[FMP-ValueList:MyFieldName2, List=YN]

<input type="checkbox" name="MyFieldName2" Value=[FMP-ValueListItem]" [FMP-ValueListChecked]>[/FMP-valueList]Display Name for Field 2

Etc.....HTH! grin.gif

  • 9 months later...
  • Newbies
Posted

Hey!

Im working with a database with lots of checckboxes. I want to be able to uncheck them on web with CDML.

The FMP Inc. has a TIL article called:

CDML: How to Edit a Checkbox Field to

Posted

Concerning the 'break' preceeding the character - I am having exactly the same problem -

HOW DID YOU END UP SOLVING IT?

Many thanks

Posted

Dear zasuwa

Did you look at the demonstration cited above? If you didn't, perhaps you should. If you did there are some things you should note.

First, on the Default page you will find, "This demonstrates one way to use a checkbox on the web

  • Newbies
Posted

I solved it by using radiobuttons, they work as expected. Infact it was very easy. I just convertted all checkboxes to radio(and kept the valuelist generated values and labels), and addes one line per button; input type radio with a static emty value, labeled "delete". It looks allright and works!

I have tried to look at the examples for checkboxbut they look too complicated. I use many checkboxes, and adding if-statements etc for all instances makes it a mess. It looks to much like a tweak, why cant it just work!

The solution in the Filemaker technote ads a return when the form is updated, thus hiding the value (because it only shows the first value), checkboxes is multiple choice, so this is natural behavior. In the layouts in the Filemaker app there is a choice for "select entire field on entry" in "field format" i guess the purpose of this is to force a checkbox to replace the contents of the entire field (instead of adding a value), if there is some hidden parameter to set to make this happen also in cdml the problem would probably be solved.

Gisle

Posted

Re: ... why cant it just work!

It can "just work".

For you it probably won't because your attitude - that "adding if-statements for all instances makes it a mess" and the examples "look too complicated" - appears to obstruct you.

If your code is messy, it is your own doing.

Posted

Hi, sorry to butt in here (again!), but this stuff is one of the few bits of CDML that's well documented:

1) Values from FileMaker:

Web user enters field data into a blank field (i.e. Search or New Record page)

--------------------------------------------------------

[FMP-VALUELIST]

<INPUT TYPE=checkbox NAME="field name here" VALUE="[FMP-ValueListItem]">[FMP-VALUELISTITEM: Always, HTML]

[/FMP-VALUELIST]<BR>

-------------------------------------------------------

Web user edits existing field data supplied

by FileMaker (i.e. Edit page)

--------------------------------------------------------

[FMP-VALUELIST]

<INPUT TYPE="checkbox" NAME="field name here" VALUE="[FMP-ValueListItem]"[FMP-ValueListChecked]>[FMP-VALUELISTITEM: Always, HTML]

[/FMP-VALUELIST]

-----------------------------------------------------

Values specified by web author:

Web user enters field data into a blank field (i.e. Search or New Record page)

----------------------------------------------------

<INPUT TYPE=checkbox NAME="field name here" VALUE="field value1 here">

field value1 label

here<INPUT TYPE=checkbox NAME="field name here" VALUE="field value2 here">

field value2 label here<BR>

------------------------------------------------------

Web user edits existing field data supplied by FileMaker (i.e. Edit page)

-----------------------------------------------------

<input type="checkbox" name=field name here value=field value1 [fmp-if: FIELD: field name here .eq. field value1]CHECKED[/FMP-IF]>

field value1 label here (item) <input type="checkbox" name=field name here value=field value2 [fmp-if: FIELD: field name here .eq. field value2]CHECKED[/FMP-IF]>

field value2 label here (item)

------------------------------------------------------

- each of these work really well for input and editing - portals, related field, the works. The only thing that doesn't is if, like me, you try it with repeating fields. (Yeah, dumb, I know. I won't do it again!)

Radio buttons are fine if you have a lot of options to a question but only want to pass one value as the answer. Checkboxes for multiple choice answers.

regards, jeff

Posted

Hi, Jeff! That's awesome... I had saved one of your earlier posts on check boxes that had helped me squeek by on a project but I had struggled w/check boxes and appreciate your re-cap here. I was going to post a CHECK BOX breakdown for everyone when I got a chance (haven't had a chance to work on my FMP stuff for months) but yours is really great so I 'll just copy/paste it into my personal reference db and enjoy it. Thanxalot!

--ST

Posted

Hi. I wish I could take the credit for it, but I gotta own up:

I started using FileMaker on the web way back with v4 and a copy of Claris Home Page, which had a built-in Filemaker library, so you just dragged and dropped icons and you could also add your own bits to it as they developed. This stuff is just copied and pasted from that library.

It's actually still a very useful resource for a quick start with CDML.

jeff

Posted

Re: this stuff is one of the few bits of CDML that's well documented:

So is the -Script tag "well documented". So too is the FMP-Link tag "well documented".

Just because something is "well documented" does not mean that it works as intended or desired.

This topic is 7791 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.