MeltDown Posted July 11, 2001 Posted July 11, 2001 I'm trying to use and IF statement based on whether the ValueListItem is or isn't checked. I've tried [FMP-ValueList: FieldName, List=ListName] [FMP-if: ValueListItem .eq. Checked] stuff in between [/FMP-If] [/FMP-ValueList] This isn't working. Any ideas??
dspires Posted July 11, 2001 Posted July 11, 2001 If the field is defined as boolean, the contents if checked will be 'true'. If the check box is a radio box to select field contents, the field contents will be whatever the checked entry is, i.e. 'blue' or 'blue /separated by returns/ red'. In this case, you could us .cn. instead of .eq. if implementing logic on field content. HTH
MeltDown Posted July 12, 2001 Author Posted July 12, 2001 Thanks for the help. But let me try explaining my problem again. I have an Add/Edit page with about 30+ checkbox items based on a ValueList. I need a reply page to display ALL the items, and whether or not each item was selected by the user. I can't find any way to just display a 'checked check-box' without using an INPUT field...and that won't work here. I was hoping to use the IF statement to determine whether or not to place an 'X' in front of the ValueListItem. According to the CDML "Book", 'ValueListItem' can be used in an IF statement on the left side of the operator, and 'Checked' can be used on the right side as long as the operator is .eq., but I can't get it working. Maybe I'm approaching this wrong...if there is a better or easier way to do this, I would love to hear about it. Thanks for your time!
Vaughan Posted July 12, 2001 Posted July 12, 2001 Inside your form put: [FMP-ValueList: fieldname, list=listname] <input type=checkbox name=fieldname value="[FMP-ValueListItem]" [FMP-ValueListChecked]>[FMP-ValueListItem: always, html][/FMP-ValueList] You may already know this, but for the benefit of others: the valuelist and checkboxes are only generated if the format file is processed by Web Companion before viewing. That is, the page cannot be viewed directly by a browser, it has to be accessed through a -view, -find, -findany or -findall action. direct viewing through a browser will result in the user seeing the cdml tags and not the checkboxes and values.
MeltDown Posted July 13, 2001 Author Posted July 13, 2001 Thanks for the help Vaughan - I appreciate your time This is almost exactly the same coding I am using on the Edit page - I didn't think to use it on the Reply page, because it is an 'INPUT' field, but it does the trick. I have a couple of questions: 1)I've always just used [FMP-ValueListItem], and not [FMP-ValueListItem: always, html]. What does the 'Always, HTML' do? 2)The check boxes appear to work, but because they aren't actually 'submitted', nothing happens. While 'nothing' is exactly what I want to happen on the Reply page, it could be confusing to viewers who just left the Edit page. Is there any way to disable the checkboxes so they can't click/change? Its a sunny day here in Oregon...how's the weather 'down-under'??
Jtown Posted July 13, 2001 Posted July 13, 2001 I'm having the same problem with the if and value list. Here's some code. [FMP-ValueList: category, List=category_list] [FMP-Record] [FMP-If: ValueListItem.eq.Field:category] something [/FMP-If] [/FMP-REcord] [/FMP-ValueList] Even if I do stuff like [FMP-If: ValueListItem.eq.somestring] it doesn't work. [ July 13, 2001: Message edited by: Jtown ]
Garry Claridge Posted July 16, 2001 Posted July 16, 2001 I have had problems placing anything else inside ValueList tags. Try swapping the tags; e.g. [FMP-Record] [FMP-ValueList:....] . . . [/FMP-ValueList] [/FMP-Record] We have used Javascript workarounds for similar types of problems. All the best. Garry [ July 16, 2001: Message edited by: garrycl ]
Jtown Posted July 16, 2001 Posted July 16, 2001 Ya, that's what my one free call to tech support said. That doesn't work with what i'm trying to do. Here's the exact situation: I want to create a menu hierarchy selection page where I click on a category and it refreshes the page with all the categories and the sub categories underneath the clicked cat. The information is all in a categories DB where I have a field call 'category' and a field called 'sub_category'. The way I get the distinct categories is with a valuelist. Beginning to see the problem? then the reload takes the category clicked and searches the db for the sub_categories. Now, my problem come when I try to display the sub_categories only underneath my category. Ican get them to appear under all the categories, but my if statement that selects when the Field-Category.eq.ValueListItem doesn't work. The answer tech support gave me was "Sorry, it can't be done." greeeeeeat. thanks for any help.
Garry Claridge Posted July 18, 2001 Posted July 18, 2001 Here is some Javascript we used to deal with Repeating fields and multiple checked options with checkboxes. It shows how we were able to work within the ValueList tags. <td width="171" align="left" valign="top"><font face="Verdana" size="1"><b>Sporting<br></b> <script> sFldValue = ""; bNewCol = false; var iItemCount = 0; Some of this may be of help. All the best. Garry [FMP-Repeating: sporting] sFldValue = sFldValue + ":[FMP-RepeatingItem]";[/FMP-Repeating] [FMP-ValueList: sporting, List= vlsports] if (iItemCount == 12 || bNewCol) { document.write('<td width="171" align="left" valign="top"><font face="Verdana" size="1"><br>'); bNewCol = false; } if (sFldValue.match(":[FMP-ValueListItem]")) {document.write('<input type="checkbox" name="sporting" value="[FMP-ValueListItem]" checked>[FMP-ValueListItem]</option><br>');} else {document.write('<input type="checkbox" name="sporting" value="[FMP-ValueListItem]">[FMP-ValueListItem]</option><br>');} iItemCount++; if (iItemCount == 12) { document.write('</font></td>'); iItemCount = 0; bNewCol = true; } [/FMP-ValueList] </script> </tr>
Keith M. Davie Posted August 23, 2001 Posted August 23, 2001 Ok. Let me start by saying that I have not read all fo this thread. I got this far: Jtown writes - "I'm having the same problem with the if and value list. Here's some code. [FMP-ValueList: category, List=category_list] [FMP-Record] [FMP-If: ValueListItem.eq.Field:category]" Of course you are. Above dspires wrote, "If the field is defined as boolean, the contents if checked will be 'true'." I have found that the use of .eq. and .neq. is limited to booleans. That is, the field must display a zero or a one. Have you tried the .cn. and .ncn. conditions? They work excellently for many things. As you must know from reading this forum, I would advise not using a valuelistitem, but instead html pop-ups directed through other cdml tags to a field which is formatted in your web layout as standard. Make your life simpler on yourself. You are the developer. All bosses really want is results. Sometimes a developer has to try different things to achieve those results. [ August 22, 2001: Message edited by: Keith M. Davie ] [ August 22, 2001: Message edited by: Keith M. Davie ]
Keith M. Davie Posted August 23, 2001 Posted August 23, 2001 Here is another approach to your valuelist. As I always suggest, display it in your web layout as a standand field - let's call it "box". Until the valuelist has an item checked the field is empty. Thus you can write a calculation field -calc such that calc = case(box="",0,1). You then write your conditional such that [fmp-if :calc .eq. 0] or whatever is appropriate for the conditions you, as the developer, create. hth
Vaughan Posted August 23, 2001 Posted August 23, 2001 This topic has gotten waaay too long, but I'll just say this: 1) Value lists DO work over the web with custom web publishing. 2) Relational value lists in FMP5 do NOT work over the web. If you cannot get value lists to work, then you are doing something wrong. Sorry to be blunt, but we get tried of newbies bursting in saying that FMP is a pos because such-and-such a feature doesn't work. Check the CDML code. Check that the field on the specified layout is also formated with the value list and menu/check box/radio button. Check that the value list actually has values in it. Make sure the html format file is pre-processed by Web Companion. To do this, create a link is a web page that is: http://blah.blah.com/path/FMPro?-db=databasename&-lay=layout&-error=errorfile&-format=formatfile&-view where formatfile is the name of the file with the valuelists in it. Now click on this link in your browser to make Web Companion processs the page. A thought -- you do have a FMP server set up and not running if from a normal web server? The code that I posted earlier is out of one of my own format files that is known to work. Just make sure you change fieldname and listname to match your own.
robmcmumbi Posted August 23, 2001 Posted August 23, 2001 quote: Originally posted by Vaughan: Inside your form put: [FMP-ValueList: fieldname, list=listname] <input type=checkbox name=fieldname value="[FMP-ValueListItem]" [FMP-ValueListChecked]>[FMP-ValueListItem: always, html][/FMP-ValueList] You may already know this, but for the benefit of others: the valuelist and checkboxes are only generated if the format file is processed by Web Companion before viewing. That is, the page cannot be viewed directly by a browser, it has to be accessed through a -view, -find, -findany or -findall action. direct viewing through a browser will result in the user seeing the cdml tags and not the checkboxes and values. I hope you might get this, Vaughan. I have tried without success to follow the advice of those on these fora regarding the use of valuelists. You said the above, and I wonder if you could clarify that for a newbie like myself. I don't understand what you mean. I have read the woefully inadequate CDML reference on -Find, -Findall, -view, and -findany. How do I apply these to make valuelists work? (Pity the CDML Reference doesn't make reference to this. Judging from the number of people who ask this kind of question...it could have caused a lot of headaches!) With thanks, Rob McDonald
robmcmumbi Posted August 23, 2001 Posted August 23, 2001 Hello again, Perhaps it would be helpful if I "post my code." Value lists don't work, but I am running into a pop-up menu being generated with CDML code inside it, a problem to which you referred, Vaughan. At the 3 or 4 points where you see MULTIPLE OPTIONS, that is where I want my value lists to come in. You will note that I have an action in the form that is "-Find." <sigh> ... <form action="FMPro" method="POST"> <INPUT TYPE="hidden" NAME="-db" VALUE="cfarmembers.fp5"> <INPUT TYPE="hidden" NAME="-lay" VALUE="basicinfo"> <INPUT TYPE="hidden" NAME="-format" VALUE="memberhit.html"> <input type="hidden" name="-Find"> <table border="4" cellpadding="0" cellspacing="2" bgcolor="#fff8dc"> <tr> <td> <table border="0" cellpadding="4" cellspacing="0"> <tr> <td colspan="4" bgcolor="#0000ff "> <center><font size="4" color="#fff8dc"><b>Please enter your search criteria below.</b></font></center></td> </tr> <tr> <td> <br> </td> </tr> <tr> <td><div align="right"><font color="#0000ff "><b>Last Name</b></font></div> </td> <td> <select name="pilast"> <option value="" selected> [FMP-VALUELIST: pilastname List="pilast"] <option value="FMP-ValueListItem">FMP-ValueListItem [/FMP-VALUELIST] <select name="pilastname"> <option>MULTIPLE OPTIONS </select> </td> </tr> <tr> <td><font color="#0000ff "><b>First Name</b></font> </td> <td> <select name="pifirstname"> <option>MULTIPLE OPTIONS </select> </td> </tr> <tr> <td><div align="right"><font color="#0000ff "><b>Institution</b></font></div> </td> <TD> <select name="institution"> <option> <option>The University of Alabama at Birmingham <option>Southern Research Institute </select> </TD> </TR> <TR> <td><div align="right"><font color="#0000ff "><b>School</b></font></div> </td> <td><font size=-1> <select name ="school"> <option>MULTIPLE OPTIONS </select> </font></td> </tr> <tr> <td><div align="right"><font color="#0000ff "><b>Department</b></font></div> </td> <td> <font size=-1> <select name="department"> <option>MULTIPLE OPTIONS </select> </td> </TR> <TR> <td><div align="right"><font color="#0000ff "><b>Division</b></font></div> </td> <td> <select name="division"> <option> <option>MULTIPLE OPTIONS </select> </td> </tr> <tr> <td colspan="4"> <hr> </td> </tr> <tr> <td><div align="right"><font color="#0000ff "><b>Research Interests</b></font></div> </td> <td> <select name="researchinterests"> <option> <option>MULTIPLE OPTIONS </select> </td> </tr> <tr> <td bgcolor="#0000ff " colspan="4" align="center"> <input type="hidden" name="-DB" value="cfarmembers.fp5"> <input type="hidden" name="-lay" value="basicinfo"> <input type="hidden" name="-format" value="memberhit.html"> <input type="hidden" name="-Find"> <input type="submit" value="Start Search"> <input type="reset" value="Clear Form"> </FORM> </table>
Anatoli Posted August 23, 2001 Posted August 23, 2001 RE: 2) Relational value lists in FMP5 do NOT work over the web. It depends. Maybe not Relational between value lists, but Relational based on Values from related file, then yes, it will work.
Vaughan Posted August 23, 2001 Posted August 23, 2001 Anatoli If the value list is simply "based on a field" then it's not relational -- that kind of value list can be done in FMP4.
Anatoli Posted August 24, 2001 Posted August 24, 2001 I did not say that. I have said, "It depends. Maybe not Relational between value lists, but Relational based on Values from related file, then yes, it will work."
Recommended Posts
This topic is 8561 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 accountSign in
Already have an account? Sign in here.
Sign In Now