Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

newbie alert!! newbie alert!! basic questions.


ranger

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

Recommended Posts

tia for the help.

i have a database called teacher.fp5, which has 80 records in it. each record has the following text fields: welcome, schedule, assignment, contact, and myclass. i also have two other text fields, named teacher and recid. i used the instant publishing to set up a web site where the teachers can locate their particular file and update any one of those fields. that was great!

now, each teacher has their own web site with the following pages:

welcome, schedule, assignment, contact, and myclass. i want the welcome page for Mrs. Johnson to pull out only the welcome text field information from her record; i want the schedule page to pull out only the schedule text field information from her record; etc.

what CDML would i use for that?

the reason i'm posting what i think is an easy question is because all the information i've read in books focus on pulling in either all fields from one record or specific text fields from all the records, but i want one text field from one record!

the next question: it would seem to me that i would need to put in the html the following code to access my database:

<form action="fmpro" method="post">

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

the teachers see the information in a layout called "plain" do i need to make some mention of that?

thanks again for the help. i have a much larger knowledge base in Photoshop, so i am more than willing to give out as much information on that as need.

carlos

Link to comment
Share on other sites

Carlos,

What you require can be done smile.gif

The query forms would look something like this:

<form action="fmpro" method="post">

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

<input type="hidden" name="-lay" value="plain">

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

Enter teacher Name:<input type="text" name="teacher" value="">

<input type="submit" name="-find" value="Enter">

</form>


The format file "welcome.html" would look like this:

<html><head></head><body>

Welcome<br>

[FMP-Field:welcome]<br>

</body></html>


Hope this helps.

Garry

Link to comment
Share on other sites

Howdy, Carlos!

You'll find garry to be one of the best sources of info in this forum (a few others, too). In this case, however, I'm not sure if you wanted more. If I am not misunderstanding, here are my own unexpert answers to some of your q's (and please forgive me if miss something 'cuz I'm sinning and not reading through your q carefully)

Here we go off the cuff...

If you have your db all set and want each teacher to have only their particular info show, you have to perform a FIND action for those records (as you can see in garry's code). This can be from web user input or you can use CDML links (or similar such) to have users click or select themselves.

A typical structure of FMP web pages is

SEARCH page > SEARCHRESULTS page (list of records) > DETAIL page

SEARCH is the first page and allows user input and "sets up" everything.

SEARCHRESULTS shows all the records that satisfy the criteria of the search (it is the format page for the search page)

DETAIL has that particular record's info (it is the format page for the search results page)

Garry's code prompts for the teacher's name but assumes no teachers have the same name (unique) and skips the search results page and goes straight to the detail page where the teacher's welcome message is shown. If teacher's don't know who they are (or rather how they were entered) this can be a problem, so you may want to let them click on their names from your front page using something called CDML links (like regular links but puts all the CDML in shorthand in the URL line of a browser and executes them all at once and kinda looks like the URL line you see in this forum but has CDML commands instead of php ones.

Of course, all of this assumes you want to really get into CDML. The basic commands and elements are not difficult (read the CDML tutorials and CDML Reference database that comes pre-installed in your application's directory/folder and you'll get the idea).

Whoopss... said more than I was gonna.... sorry. I'll finish up with these comments:

plain.

Specifying the layout is good practice. I usually make a custom layout just for the web ("weblay" or something) and put all the fields i want accessible on it; if you try to access a field not on the layout you'll get an error. This does not mean all fields on that layout must be shown, however. Garry's "welcome.html" page, for example, just shows the welcome message but you could add the schedule field, too, or any of the fields you placed in the "plain" layout.

Thanx for the PS offer. You can make some really cool interface dressing for your webpages, though!

ST

Link to comment
Share on other sites

Hi,

may be it's basic question and already discussed,what i want is i want an option to change password.In that i had the user has to enter the new password two times.i tried this one by using edit,but it's not working.can any one pls give me code if possible for this one.

thank you

sri

Link to comment
Share on other sites

hey, Stranger!

thanks for the info, but i already have set up all the search pages, etc., through the FM instant web publisher, just like you suggested. my problem was that i only need one text field per teacher record per html page. see, the html pages are already set up; i just want the welcome page that the parents see to pull out the welcome text field from that particular teacher's record. i'm trying to avoid having to re-do all the html to match what FM produces. do i make sense? i just want the little bit of cdml code that will pull that out. i'll post my results.

carlos

Link to comment
Share on other sites

"i want an option to change password.In that i had the user has to enter the new password two times"

Hi, two ways to do this: in the database by using field validation or the one i prefer, on the page with a really simple javascript.

<HTML>

<HEAD>

<script language="JavaScript" type="text/javascript"><!--

function checkPassword(form) {

password1 = form.thefieldname1.value;

password2 = form.thefieldname2.value;

if (password1 != password2) {

alert ("The passwords do not match. Please re-enter the password")

return false;

}

else return true;

}

//--></script>

</HEAD>

<BODY>

<P><FORM ACTION="" METHOD=POST onsubmit="return checkPassword(this)">

<P>enter password<INPUT TYPE=text NAME=thefieldname2 VALUE="" SIZE=10></P>

<P>re-enter password<INPUT TYPE=text NAME=thefieldname1 VALUE="" SIZE=10></P>

<P><INPUT TYPE=submit NAME=Submit VALUE="Submit!">

</FORM></P>

</BODY>

</HTML>

..just change the fieldnames in the form and in the script to match yours and change them to password fields so that you get that row of dots. I think you'll need the second password field to exist in your Filemaker layout becouse its value is going to be passed when you submit the form

regards, jeff

Link to comment
Share on other sites

Hi,

I have two buttons in the same page.When i am trying to click any button it's executing the second code.Can any one tell me what's problem.I checked two format files several times.But i didn't get that one.

The code for two buttons are below

<TD>

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

<P><INPUT TYPE="hidden" NAME="-RecID" VALUE="[FMP-currentrecid]">

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

<P><INPUT TYPE="hidden" NAME="-lay" VALUE="layout1">

<P><INPUT TYPE="hidden" NAME="-format" VALUE="editpers.htm">

<P><INPUT TYPE="submit" NAME="-edit" VALUE="edit personal information">

</TD>

<TD>

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

<P><INPUT TYPE="hidden" NAME="-RecID" VALUE="[FMP-currentrecid]">

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

<P><INPUT TYPE="hidden" NAME="-lay" VALUE="layout1">

<P><INPUT TYPE="hidden" NAME="-format" VALUE="edit.htm">

<P><INPUT TYPE="submit" NAME="-edit" VALUE="change password">

</TD>

Link to comment
Share on other sites

Hi, sricant... I'm answering this from a weird thread where jeff spall answerd another of your q's...

Anyway, assuming you showed all your code, I think you need to close your FORMs with </FORM> after each submit button. That makes each one discreet and separate. I also found you cannot nest or overlap forms, either, but you can still have serveral on any given page.

Hope it helps!

Link to comment
Share on other sites

Hi, if you only need to protect entry to the site and not to individual records then you can have a database which just consists of username and password. For entry you do a search on this, using javascript to force the user to input values into both the name and password fields.

<SCRIPT LANGUAGE="JavaScript"><!-- Begin

function checkrequired(which) {

var pass=true;

if (document.images) {

for (i=0;i<which.length;i++) {

var tempobj=which.elements;

if (tempobj.name.substring(0,8)=="required") {

if (((tempobj.type=="text"||tempobj.type=="password")&&

tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&

tempobj.selectedIndex==0)) {

pass=false;

break;

}

}

}

}

if (!pass) {

shortFieldName=tempobj.name.substring(8,30).toUpperCase();

alert("You must fill in both username and password");

return false;

}

else

return true;

}

// End --></script>

the positive result find (like there's a match for the username and password) takes you to your database, the search error to a 'try again' page.

If you want to make a call on the database straight away, use an inline action.

If you need to restrict your user to only certain records, then you'll have to have the username and password field in the main database and entered on each record, then search on that each time, like:

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

<P><INPUT TYPE="hidden" NAME="-DB" VALUE="database">

<INPUT TYPE="hidden" NAME="-Lay" VALUE="Layout1"> <INPUT TYPE="hidden" NAME="-format" VALUE="usersearch_results.htm">

<INPUT TYPE="hidden" NAME="-error" VALUE="usersearch_error.htm">

<INPUT TYPE="hidden" NAME="-SortField" VALUE="datetodie">

<INPUT TYPE="hidden" NAME="-SortORder" VALUE="Descending"><INPUT TYPE="hidden" NAME="-max" VALUE="20"></P>

<P>inputyour password to view or amend all of your records.</P>

<P><INPUT TYPE="hidden" NAME="-op" VALUE=eq><INPUT TYPE=password NAME=password VALUE="" SIZE=20><INPUT TYPE="submit" NAME="-Find" VALUE="go">

</FORM>

....again validate mutiple fields with javascript.

Bear in mind that both of these are OK for regular use but are really not secure if you have genuinely sensitive stuff to protect.

regards, jeff

Link to comment
Share on other sites

Hi jeff,

thank you for ur help.And i have another may be it's also simple.

I have two databases people.fp5 and office.fp5 with common field username.First he user has to enter username and password,then he gets his personal information only.

Upto this one i got without any problem.Now what i want is a button with "office details" in that personal information page.When i click that button i have get office details of that perticular username.and i dont't want to enter username again.

any suggestions please....

thank you

sri

Link to comment
Share on other sites

Hi, i think there's a number ways to crack this: pass a token that gets added to the search from one database to another, or just an embeded field, which will often work. Pass the value of whatever is is that you use to create the relationship between those records.

I did something like this a couple of years ago where a company updated their directory details online and that had at least half a dozen different related databases. Once they'd logged in with their company code number - just a search for it in the main company database - I just passed the unique 'companykey' number from page to page as a hidden search field - worked for edit and new as well.

Again, the warning applies that these are ok for normal use but are not really secure for sensitive stuff.

here I'm in the main company details page and I want to see and edit all of their trading names, which is in a separate file so within a little form area:

<INPUT TYPE="hidden" NAME="-DB" VALUE="tradingnames">

<INPUT TYPE="hidden" NAME="-Lay" VALUE="Layout11"> <INPUT TYPE="hidden" NAME="-format" VALUE="forecourt/tradingnamesf/search_results.htm">

<INPUT TYPE="hidden" NAME="-error" VALUE="forecourt/tradingnamesf/search_results.htm">

<INPUT TYPE="hidden" NAME="-SortField" VALUE="tradingname">

<INPUT TYPE="hidden" NAME="-SortORder" VALUE="Ascending"><INPUT TYPE="hidden" NAME="-max" VALUE="20"><INPUT TYPE="hidden" NAME="-lop" VALUE=AND><INPUT TYPE="hidden" NAME="-op" VALUE=eq>

<INPUT TYPE=hidden NAME=companykey VALUE="[FMP-Field: companykey]"><INPUT TYPE=image SRC="images/tradenames.gif" NAME="-Find" WIDTH=90 HEIGHT=35 BORDER=0 ALIGN=bottom value="edit trade names">

I'm just using

<INPUT TYPE=hidden NAME=companykey VALUE="[FMP-Field: companykey]">

to pass that search value.

You could also write that as a url link, which is how I think I'd do it now, because then you can put it within your main form area if you want,which can make page layout easier:

blah blah &-op=eq&companykey=[FMP-Field: companykey]&-Find

or you could show the data on the same page by calling the second database as an inline action:

...,-op="eq",companykey="{FMP-Field:companykey}",-Find]

In each case, that field could be a token, but the field itself usually works just fine. This stuff also works as one-to-many with a portal or as search returns.

....or you could just have the office details info as related fields in the people.fp5 database. All of these will work and are really easy to write.

Mail me if you want some complete CDML pages to look at.

regards, jeff

Link to comment
Share on other sites

Here is an example of a complete page:

<html><head></head>

<body>

User Details:<br>

[FMP-Field:name]<br>

[FMP-Field:otherdetails] .....

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

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

<input type="hidden" name="-lay" value="web">

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

<input type="hidden" name="username" value="[FMP-Field:username]">

View Office Details:<input type="submit" name="-find" value="Click Here"></form>

</body></html>


Hope this helps.

Garry

Link to comment
Share on other sites

Hi, here's a real simple one, it's a very basic message board a Kinda toy version of this.

There are two databases: Messageboard, where the user creates the original thread and one called message that stores the reply. The record number of the original thread gets passed to the 'message' database and so the two remain tied together. It's made for just one purpose - leaving quick notes on an Intranet site, so the threads time out after a couple of days, but it shows how to link related new records and to edit, you'd use the same mechanism but as a find.

to call it on your own computer:

http://localhost:591/messageboardf/FMPro?-db=messageboard&-lay=layout1&-format=default.htm&-error=default.htm&-view

oh, and I've just noticed that it also uses a redirect page to show the result of what you did. The databases are in the zip file,too so you should be abe to get it woring on a single computer. I think I've set it all to 'localhost on port 591, but I might have missed something.

regards, jeff

messageboardf.zip

Link to comment
Share on other sites

Hi garry,

Thanks for ur help and i tried to execute that code i am getting error like the layout is "lay1" could not be accessed.For the reference i am giving my code,maybe there is something wrong in the code.

<TD>

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

<P><INPUT TYPE="hidden" NAME="-RecID" VALUE="[FMP-currentrecid]">

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

<P><INPUT TYPE="hidden" NAME="-lay" VALUE="layout1">

<P><INPUT TYPE="hidden" NAME="-format" VALUE="editpers.htm">

<P><INPUT TYPE="submit" NAME="-edit" VALUE="edit personal information">

</FORM>

</TD>

<TD>

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

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

<P><input type="hidden" name="-lay" value="lay1">

<P><input type="hidden" name="-format" value="office.htm">

<P><input type="hidden" name="username" value="[FMP-Field:username]">

<P><input type="submit" name="-find" value="Click Here">

</form>

</TD>

thank you,

sri.

Link to comment
Share on other sites

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