Jump to content

-recid and [FMP-CurrentRecID] Question


Chirriras
 Share

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

Recommended Posts

Okay, let's try this from another angle and see if I can get it. Could someone please explain the -recid with [FMP-CurrentRecID]?

I have a very long form that it is quite likely individuals will not complete at one sitting. Forget getting into the form to create a record for now, let's concentrate on getting BACK into the record.

Let's look at the database itself first. I created a text field called CaseNo. In "Options", under "Auto-Enter" I defined it as a Serial Number, set the originating number and have it increase in increments of 1, and checked "Prohibit modification of value".

Under "Validation" the following boxes are checked: "Not Empty", "Unique", "Maximum number of characters" (set at 6), and "Strict: Do not allow user to override validation".

Here is what I WANT to happen next: I have a "search" page where the user enters in the CaseNo established when the record was created. When "Submit" is clicked, the original form opens so they can complete or edit the data on a specific form.

Is CaseNo the number what recid and [FMP-CurrentRecID] will refer to or is there some secret internal number generating system involved?

Link to comment
Share on other sites

Not really a secret. The [FMP-CurrentRecID] is the same as the "Status(CurrentRecID)" from filemaker. It is not the serial number you describe. You can still use your CaseNo id as long as you are absolutely sure it is a unique value in your database (so do no use "duplicate"!). Your CDML should look something like:

<BODY>

<P><FORM ACTION="FMPro" METHOD="post">

<P><INPUT TYPE="hidden" NAME="-db" VALUE="DATABASE.fp5">

<P><INPUT TYPE="hidden" NAME="-LAY" VALUE="CGI">

<P><INPUT TYPE="hidden" NAME="-format" VALUE="CaseDetails.html">

<p><input type="hidden" name="-Max" value=1>

<p><input type="hidden" name="-op" value="eq">

CaseNo: <INPUT TYPE="text" NAME="CaseNo" VALUE="" SIZE=30><br>

<INPUT TYPE="submit" NAME="-find" VALUE="Start Search" SIZE=30>

<INPUT TYPE="reset" VALUE="Clear Form" SIZE=30>

</BODY>

If you are not so sure about the uniqueness of your caseno I suggest changing the "Casedetails.html" in a "CaseList.html" where you list all records with the CaseNo.

Wouter.

P.S. If you use the Web Security Database you can set the Caseno to only accept "ExactSearch". This will also eliminate a "contains" type of search on your field.

Link to comment
Share on other sites

The "RecID" is a unique number generated by FM. You need this number to be able to "-edit" records.

To start the process you need to do a "-find" using the "CaseNUmber", then you need the "RecID" to edit. For example in the edit page you need this:

<input type="hidden" name="-recid" value="[FMP-CurrentRecID]">

<input type="submit" name="-edit" value="Submit Updates">

Alternatively, you can pass the "RecID" around with a "-token". For example after the "Find" page:

<input type="hidden" name="-token" value="[FMP-CurrentRecID]">

However, I don't think that you will need to do this from your menu page. As each section link in your menu may look like this:

<a href="FMPro?-db=surveys.fp5&-format=sectionx.html&CaseNumber=[FMP-Field:CaseNumber]&-find">Goto Section X</a>

This is after the user has "logged-in" and been presented with the Menu page.

All the best.

Garry

Link to comment
Share on other sites

Okay, here's a new wrinkle. Explain this one for me. I put both [FMP-CurrentRecID] and [FMP-Field:CaseNo] in the form side by side to see what happens. Both numbers appear. CaseNo is a low, 3 digit number, just like it should be. RecID is a 6 digit number, I have no idea where it comes from, but that's ok.

When I process the -find, two things happen, neither of which are good, and neither of which I can understand.

First, it DOES find the correct record but it doesn't show any of the data already entered in the record. It looks like a blank record. When I look in FMP, I can see the record chosen and the data is there, but it doesn't appear on the browser form.

Second, it leaves the db with only the one record available. I have to go into FMP and select "Show All Records" to get everything back. That won't do. I know I'm doing something wrong, and it's probably dumb, but I can't figure out what it is.

Any help?

Link to comment
Share on other sites

etucker47 said:

RecID is a 6 digit number, I have no idea where it comes from, but that's ok.

As Garry said in his post this is generated by filemaker itself, every record in every database has a RecId number

First, it DOES find the correct record but it doesn't show any of the data already entered in the record. It looks like a blank record. When I look in FMP, I can see the record chosen and the data is there, but it doesn't appear on the browser form.

There is something wrong in your code, maybe you could post the code here

Second, it leaves the db with only the one record available. I have to go into FMP and select "Show All Records" to get everything back. That won't do. I know I'm doing something wrong, and it's probably dumb, but I can't figure out what it is.

This is normal behaviour, you are performing a find so it finds the record in the database. You do not need to do a show all records for all records to be available over the web, the next person accessing the database will do a find and the same will happen again.

It is just as though you were sat at the database and perform a find, what happens...the only record you see is the one you just found.

Hope this helps

Ed

Link to comment
Share on other sites

I have tried to simplify things by using only two pages (plus the thank you page). In order to let you see what I have done, I have copied the files and deleted most of the questions. I have left the code intact, so you can see how it works (or doesn't work) and maybe find a clue to why I can't get it to work correctly.

You will need a userid and password to get in (if it works correctly). Use fmforums for the user id, and use netcheck for the password.

You should be able to create a new record with no problem at all. If you choose to do this, please enter something in the text boxes to use for comparison when trying to call up the form for editing.

The problem I am having is getting to call a previously entered record AND show the contents already entered. You can call any of the cases below (the other cases do not have data in the fields left on the form). The 3 digit number is the Case Number (CaseNo) and the 6 digit number is the RecID. Any assistance will be sincerely appreciated.

112/32947

114/32949

120/32955

124/32959

Link to comment
Share on other sites

I guess maybe I should give the URL if I want you to look at it!

Here's an over view of what I'm trying to do.

http://webserv1.lsr.nd.edu/webtest.htm is the opening screen. This page give instructions on starting a new record, or editing an existing one, and contains a button for each choice. I do this so that when the new record is opened, a new case number will be generated. Otherwise the number would not be generated until the case was submitted. I want the case number to show up on the survey form. Clicking on the New Case record takes you to the survey form.

To edit a record, enter in either a 3 digit case number then click the Edit Case button (I added the 6 digit RecID to see if anything happens when that number is entered instead--so far nothing has) The Edit Case button will take you to the survey form, and the requested case number will appear in the box, but no data appears. In each of the numbers I have in the previous post, there is data entered in most of the fields. This is my final stumbling block to having this project completed.

Link to comment
Share on other sites

Yep. I've followed it religiosly, it seems to me. Here is my code for the menu page:

Headers:

<form action="FMPro" method="POST">

<input type="hidden" name="-db" value="RelPol.fp5">

Search Code:

<input type="text name="CaseNo" value="">

Link Code:

<a href="FMPro?-db=RelPol.fp5&-format=Religion1.htm&CaseNo=[FMP-Field:CaseNo]&-find">

(repeated for sections 2-7 with just the name of the section changed)

I enter a number in the search box (124 for example), then press the link for the section I need to go to. In the database, it calls up that record, but on the screen I get the message "No records found. Modify your search criteria".

I tried it without the search code, and the same thing happens. Don't I need the search box in order to tell it which case number to look for? This is why I keep saying I'm losing my mind--I think I'm doing it right but it doesn't work, so I HAVE to be doing something wrong.

The example I put up is a dummy file I created. I am so desperate to get this done that I'm willing to scrap the multiple page version of it. I just want to get back in and be able to see the data previously entered. No matter how I go about it, that just doesn't happen and I have no idea why.

I notice my web files are htm, while the example you set up is html. Is this relevant?

Link to comment
Share on other sites

Re: htm v html

No difference.

Re: "No records Found"

So, if you click on a link in the "Menu" page you receive this message!

I assume you got to the "Menu" page by entering the CaseNo in the "Login" page? Hence, the line:

<a href="FMPro?-db=RelPol.fp5&-format=Religion1.htm&CaseNo=[FMP-Field:CaseNo]&-find">

should look like this when you "View Source" of the "Menu" page in your browser:

<a href="FMPro?-db=RelPol.fp5&-format=Religion1.htm&CaseNo=124&-find">

Can you post the code for your "Login" page and for your "Menu" page?

The "Menu" page should not have any Forms. Only links!

The "Login" page has a Form.

All the best.

Garry

Link to comment
Share on other sites

Better yet. I created 3 dummy files, with only the necessities to struggle through this. Using the same userid and password above. The files have simple names so we can both be sure we are on the same page.

http://webserv1.lsr.nd.edu:591/login.html

http://webserv1.lsr.nd.edu:591/menu.html

http://webserv1.lsr.nd.edu:591/form.html

There is something wrong with the code on the first one because I can hope menu.html fine when I call it directly, but when login.html calls it, I get half a line of code on the screen instead.

Take a look. If I can make it work on these three simple files, I can convert it to the bigger picture.

As always, thanks a million.

Link to comment
Share on other sites

I have my code corrected now. You can go to http://webserv1.lsr.nd.edu:591/login.html and enter 124 in Case Number, then click Find Case

That will bring up http://webserv1.lsr.nd.edu:591/menu.html which currently has only one link (let's jump off one bridge at a time) Click the link, and you will be taken to

http://webserv1.lsr.nd.edu:591/form.html

The source code for this page now is:

<HTML>

<HEAD>

<TITLE>form</TITLE>

<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</HEAD>

<BODY bgcolor="#FFFFFF" text="#000000">

<form action="FMPro" method="POST">

<input type="hidden" name="-db" value="RelPol.fp5">

<input type="hidden" name="-format" value="menu.html">

<BR>

<BR>

Case Number: 124<BR>

<BR>

Location: <input type="text" name="IntvCity" value="">

<BR>

Religion<BR>

<Select Name="S01_01d">

<Option Value=""> Click here and choose one</option>

<Option Value="Hindu"> Hindu</option>

<Option Value="Sunni Muslim">Sunni Muslim</option>

<Option Value="Shi'ite Muslim">Shi'ite Muslim</option>

<Option Value="Buddhist">Buddhist</option>

<Option Value="Jain">Jain</option>

<Option Value="Catholic">Catholic</option>

<Option Value="Protestant">Protestant</option>

<Option Value="Orthodox">Orthodox</option>

<Option Value="Other">Other</option>

<Option Value="None">None</option>

</select><BR>

<BR>

Sex<BR>

<INPUT TYPE="radio" NAME="S01_01b" VALUE="Male">Male <br>

<INPUT TYPE="radio" NAME="S01_01b" VALUE="Female">Female<BR><BR>

<input type="hidden" name="-recid" value="32959">

<input type="submit" name="-edit" value="Update Survey">

</form>

</BODY>

</HTML>

This brings up the correct record, but here is the problem. Each of these fields contain data: City is Seelyville; Religion is Catholic; Gender is Male, but NONE of these appear on the screen. You can type in new data, and when you click Update Survey, it will change the information in the correct record, BUT you can't see what is already there. Why not?

Link to comment
Share on other sites

OK smile.gif

This is what you need:

Location: <input type="text" name="IntvCity" value="[FMP-Field:IntvCity]">

<BR>



For the <select> and Radio Button type of questions we need to use [FMP-If] to find the Selected/Checked values. For example:


Gender<BR>

[FMP-If:S01_01b.eq.Male]

<INPUT TYPE="radio" NAME="S01_01b" VALUE="Male" checked>Male <br>

<INPUT TYPE="radio" NAME="S01_01b" VALUE="Female">Female<BR><BR>

[FMP-Else]

<INPUT TYPE="radio" NAME="S01_01b" VALUE="Male">Male <br>

<INPUT TYPE="radio" NAME="S01_01b" VALUE="Female" checked>Female<BR><BR>

[/FMP-If]

Hope this helps.

Garry

Link to comment
Share on other sites

For the <select> I'll assume that you are using a Valuelist on that field in the FM Layout. (If not the FMP-If is just as good.)

<Select Name="S01_01d">

[FMP-Option: S01_01d, list=religions]

</select><BR>

This will automatically select the value in the field.

All the best.

Garry

Link to comment
Share on other sites

Is this right?

Gender<BR>

[FMP-If:S01_01b.eq.Male]

<INPUT TYPE="radio" NAME="S01_01b" VALUE="Male" checked>Male <br>

<INPUT TYPE="radio" NAME="S01_01b" VALUE="Female">Female<BR><BR>

[FMP-Else]

<INPUT TYPE="radio" NAME="S01_01b" VALUE="Male">Male <br>

<INPUT TYPE="radio" NAME="S01_01b" VALUE="Female" checked>Female<BR><BR>

[/FMP-If]

When I run a preview of this, the code shows on the page instead of just the two options. Is this because I am doing this on a stand alone, and not a computer that is feeding into the db, or is there something wrong with my code?

Link to comment
Share on other sites

Re: . Is this because I am doing this on a stand alone, and not a computer that is feeding into the db

Correct, the CDML will only be processed by WebCompanion, otherwise it shows in the page as text.

I will look for a shorter way of doing the Radio Buttons smile.gif

All the best.

Garry

Link to comment
Share on other sites

Idea: what would happen if you web-ised a layout with Instant Web Publishing and copied the resulting HTML code... would it work?

Link to comment
Share on other sites

Checkboxes:

Would this be the correct code for checkboxes? I seem to be having a little trouble with them.

[FMP-If:S01_02d.eq.own a car?]

<INPUT TYPE="checkbox" NAME="S01_02d" VALUE="own a car?" checked>own a car?<br>

[FMP-If:S01_02d.eq.own a house?]

<INPUT TYPE="checkbox" NAME="S01_02d" VALUE="own a house?" checked>own a house?<br>

[FMP-If:S01_02d.eq.own a refrigerator?]

<INPUT TYPE="checkbox" NAME="S01_02d" VALUE="own a refrigerator?" checked>own a refrigerator?<br>

[FMP-If:S01_02d.eq.have servants?]

<INPUT TYPE="checkbox" NAME="S01_02d" VALUE="have servants?" checked>have servants?<br>

[/FMP-If]

Link to comment
Share on other sites

Try this:

<INPUT TYPE="checkbox" NAME="S01_02d" VALUE="own a car?"[FMP-If:S01_02d.eq.own a car?] checked[/FMP-If]>own a car?<br>

<INPUT TYPE="checkbox" NAME="S01_02d" VALUE="own a house?"[FMP-If:S01_02d.eq.own a house?] checked[/FMP-If]>own a house?<br> 

<INPUT TYPE="checkbox" NAME="S01_02d" VALUE="own a refrigerator?"[FMP-If:S01_02d.eq.own a refrigerator?] checked[/FMP-If]>own a refrigerator?<br> 

<INPUT TYPE="checkbox" NAME="S01_02d" VALUE="have servants?"[FMP-If:S01_02d.eq.have servants?] checked[/FMP-If]>have servants?<br>

All the best.

Garry

Link to comment
Share on other sites

Here is a revised version of the Checkboxes, this will handle multiple entries:

<INPUT TYPE="checkbox" NAME="S01_02d" VALUE="own a car?"[FMP-If:S01_02d.cn.car] checked[/FMP-If]>own a car?<br>



<INPUT TYPE="checkbox" NAME="S01_02d" VALUE="own a house?"[FMP-If:S01_02d.cn.house] checked[/FMP-If]>own a house?<br> 



<INPUT TYPE="checkbox" NAME="S01_02d" VALUE="own a refrigerator?"[FMP-If:S01_02d.cn.refrigerator] checked[/FMP-If]>own a refrigerator?<br> 



<INPUT TYPE="checkbox" NAME="S01_02d" VALUE="have servants?"[FMP-If:S01_02d.cn.servants] checked[/FMP-If]>have servants?<br>

I've changed the .eq. to .cn. because this type of field is a list of multiple entries.

Sleep well smile.gif

Garry

Link to comment
Share on other sites

One more minor adjustment needed to be made.When I set up the radio buttons as outlined above, I found I still had one problem. When I created a new record, all the multiple choice questions had the last option checked. This won't do, this would skew the data when analysis time rolled around. I needed all fields to be blank until something was intentionally entered. I found that by adding one more set to the values, with nothing "checked" the field remaned empty until something was checked by the user. Example:

O Yes

O No

Code:

[FMP-If:S01_01b.eq.Yes]

<INPUT TYPE="radio" NAME="S01_01b" VALUE="Yes" checked>Yes <br>

<INPUT TYPE="radio" NAME="S01_01b" VALUE="No>No<BR

[FMP-Else]

<INPUT TYPE="radio" NAME="S01_01b" VALUE="Yes">Yes <br>

<INPUT TYPE="radio" NAME="S01_01b" VALUE="No" checked>No<BR

[FMP-Else]

<INPUT TYPE="radio" NAME="S01_01b" VALUE="Yes">Yes <br>

<INPUT TYPE="radio" NAME="S01_01b" VALUE="No">No<BR

[/FMP-If]

Link to comment
Share on other sites

Well done smile.gif

I would also look at using it with an [FMP-ElseIf] tag. For example:

[FMP-If:myfield.eq.yes]

<input type="radio" name="myfield" value="yes" checked>Yes

<input type="radio" name="myfield" value="no">No

[FMP-ElseIf:myfield.eq.no]

<input type="radio" name="myfield" value="yes">Yes

<input type="radio" name="myfield" value="no" checked>No

[FMP-Else]

<input type="radio" name="myfield" value="yes">Yes

<input type="radio" name="myfield" value="no">No

[/FMP-If]

All the best.

Garry

Link to comment
Share on other sites

Hi, I've been using code that means you don't have to hard code all of the options.

on an edit page

for check boxes:

[FMP-VALUELIST: myfieldname, LIST=myvaluelistname]

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

[/FMP-VALUELIST]

for radio buttons:

[FMP-VALUELIST: myfieldname, LIST=myvaluelistname]

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

[/FMP-VALUELIST]

they'll be checked/unchecked depending upon the data in the record. The nice thng about this is that you only need to update the value ist, not all the html

regards, jeff

Link to comment
Share on other sites

I tried this, unsuccessfully, of course. Here's my code:

[FMP-VALUELIST:S02_10, List=Religious Relations]

< INPUT TYPE="radio" NAME="S02_10" VALUE="[FMP-ValueListItem]"

[FMP-ValueListChecked]>[FMP-VALUELISTITEM:Always, HTML] [/FMP-VALUELIST]

Here's what shows up on the web page when it opens:

< INPUT TYPE="radio" NAME="S02_10" VALUE="Always positive">Always positive < INPUT TYPE="radio" NAME="S02_10" VALUE="Frequently positive">Frequently positive < INPUT TYPE="radio" NAME="S02_10" VALUE="Occasionally positive">Occasionally positive < INPUT TYPE="radio" NAME="S02_10" VALUE="Occasionally negative">Occasionally negative < INPUT TYPE="radio" NAME="S02_10" VALUE="Frequently negative">Frequently negative < INPUT TYPE="radio" NAME="S02_10" VALUE="Always negative">Always negative < INPUT TYPE="radio" NAME="S02_10" VALUE="We have no interaction">We have no interaction < INPUT TYPE="radio" NAME="S02_10" VALUE="Other">Other

What did I do wrong?

Thanks.

Link to comment
Share on other sites

Round 2: I took the space out between < and INPUT and now it displays the radio button options--HOWEVER, they run continuously instead of each one being on a separate line. NOW what do I do?

Why is nothing ever as simple as it seems?

Link to comment
Share on other sites

Okay, one more thing (I swear that will be engraved on my tombstone--"Just one more thing"!!).

I have many, many textarea fields. They are lovely empty boxes when entering data for the first time. HOWEVER, when going back into the record to edit it, the text does not appear. It is in the database, but it does not appear on the web. I have tried a number of combinations to fix this, but so far nothing works. When I change it to an INPUT TYPE="text" field, it gives me a little box one line high and about 25 character maximum. This is woefully inadequate. I have tried many variations of playing around with both textarea and "text" and so far nothing works.

Can you help me iron this one out?

Link to comment
Share on other sites

I found the solution, but for some reason couldn't get back in to tell you. It works like a charm, here it is:

<TEXTAREA NAME="S07_02x" rows="7" cols="85" [color:"red"]WRAP=virtual> [FMP-Field:S07_02x]</textarea>

The only difference between this and a standard textarea code is the addition of the [color:"red"] WRAP command, and moving the [color:"red"] > from after the field name to before it. Now my large text boxes appear exactly as I want them, with the text visible.

This has been a wonderful, exasperating, exhausting, and rewarding experience. I feel like I've been through a wringer, and a whole semester of classes, just on this one project. Thank you all so much, but particularly Garry, without you it wouldn't have gotten done. I appreciate your generosity and all your help more than you will ever know.

the many faces of teaching this old dog some new tricks--confused.giffrown.gifooo.gifblush.gifsmirk.gifsmile.giflaugh.gifgrin.gif

Link to comment
Share on other sites

This topic is 6513 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
 Share

×
×
  • Create New...

Important Information

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