Jump to content

I'm back with more complicated stuff!


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

Recommended Posts

Hey All!

I've been all through this forum and I'm sill haven't found anything.

Ok... Is it possible to have a set of records submitted all at one time!?

If so, does anyone care to share?

Work Flow: I have a set of records that get displayed. THEN the user will check a check box so they can edit the ones THEY want to edit. After that, the press a button (or link) that says "Edit Selected", they get taken to an "Edit" format where their selections are available to them to edit. Once they've made their changes, they press a button (or link) that say's DONE and they get sent back to the original page with their changes showing.

I can do this in Javascript by itself, but I'm using CDML which is good and bad... it's good because creating arrays are easier to make, but I can't get a handle to the "name = FieldName" because CDML uses it to identify the field in the Database. crazy.gif

So now I don't know of a way to poperly generate this.

I've tried to run a submit at the bottom of the page to update the changes, but all of the changes end up on the last record in the list. I think that's because they all have the same name.

Does ANYONE have a solution that works and doesn't mind sharing?

Link to comment
Share on other sites

Hi, Addam!

I don't think you can... I think FMP only allows a single user to access one record at a given instance. Can you put a SUBMIT after each item, i.e. each item is a mini-form whose format page is itself until you hit "DONE/EXIT" or something? Too slow?

Link to comment
Share on other sites

Does anyone know how or IF we can do a search on more than one value in a field via the web?

Example:

Field 1...

I want to find "Addam" and "Eddie" in the same field.

What is the syntax for that? If I get that, I have a way using Javascript do complete the submission all at one time. I will gladly share it with the community!

Link to comment
Share on other sites

Addam,

You can use the Logical Operator "-lop". This is how you would use it:

...

<input type="hidden" name="-lop" value="or">

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

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

etc...

OR

Using Javascript you can also list the values in the one value parameter separated by spaces. So that the form would end up like this:

<input type="hidden" name="-lop" value="or">

<input type="text" name="Field1" value="Addam Eddie">

Check the "CDML Reference" database for a better explanation.

Hope this helps.

Garry

Link to comment
Share on other sites

Garry... Thank you! That was what I needed to know...

Phew!

OK!! I've got this thing moving quite well now!

I've configured Javascript to grab all the checked elements and do a search on those that are and display them in a similar page that allows the user to edit them, if anyone want's the format, I'll gladly put it up.

New Problem! (gotta love 'em).

I used a similar technique with the forms. I have a script that will start at the second FORM and submit, THEN goto the NEXT form and do the same, but it doesn't seem to work. What it will do is only submit the LAST form on the page. The syntax is correct. Does FileMaker actually allow multiple form submission from a single page at one time? Does anyone know how it handles the submission of "-Edits"?

~Addam~

Link to comment
Share on other sites

OOOhhhh... Ok!

Now I've started playing with the frames... It works for maybe 1 or 2 records...

I've created a "<base target="_blank"> in my header and every time the Javascript cycles through the forms, it opens a new window to process the data then it closes automatically once the data is processed. I've also moved that to the "FORM" tag and it does the same thing. The only problem with this is if I have 20 records I was editing at one time, then I get 20 small windows that open up! lol It's a great way to crash a machine!

If I do it in a frame, it won't process everything. Not sure how to get around this... any suggestions?

Link to comment
Share on other sites

OK!

Got it working so far... there are some minor bugs to work out in the UI, but all is well...

Javascript Code:

function editMe(){

var f=document.forms;

for (s=1;s<[FMP-RangeSize]+1; s++){

f.submit();

}

alert("This process may take a few seconds to complete. Please wait for the screen to take you back to your original view.");

}

// There is another function that refreshes the screen after this...

HTML Code: (If you break out this out into a table, it will look better.)

<a href="#" onClick="editMe();setTimeout('wait()',[FMP-RangeSize]000);">Done</a>

<!-- the wait is a function that refreshes the screen. I used the "[FMP-RangeSize]000" to give it 1 second per record found. The "Done" acts as the submit button. -->

[FMP-Record]

<form action="FMPro" method="post" name="controls[FMP-CurrentRecId]" target="frame[FMP-CurrentRecId]">

<input type="hidden" name="-DB" value="[FMP-CurrentDatabase]">

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

<input type="hidden" name="-RecID" value="[FMP-CurrentRecId]">

<input type="hidden" name="-Max" value="25">

<input type="text" name="First Name" value="[FMP-Field: First Name]">

<input type="text" name="Last Name" value="[FMP-Field: Last Name]">

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

<input type="hidden" name="-edit">

</form>

<iframe name="frame[FMP-CurrentRecId]" id="frame[FMP-CurrentRecId]" height="1" width="1"></iframe>

[/FMP-Record]

I used Javascript ("for loop") to step through each form and submit ("document.forms[?].submit();") each one into it's own ("<Iframe...>").

I also set a timer to activate another script to take me back to the "Read Only" version of this page with the new information submitted. It works, but not sure of it's stability. That's the part I'm trying to work out. I'm not sure if there is a way in Javascript to activate another script once the loops are complete. I'm gonna keep looking on that.

I hope this helps anyone else with the same goal! You can copy and paste this code in, change a few things (format, fields, etc.) and this should work for you.

Thanks a bunch! you all were great!

~Addam~

Link to comment
Share on other sites

Well done Addam.

re: not sure if there is a way in Javascript to activate another script once the loops are complete

You could try an "onload" Javascript in the last iframe. You could have a dummy last iframe. I'm just guessing. The "timed" execution of the "refresh/reload" may be the best way.

All the best.

Garry

Link to comment
Share on other sites

Thanks!

The "OnLoad" event wouldn't work in this case... Then it would do it for all of them.

It's ok... The problem lies in the server. I don't know how long it will take for the transaction(s) to complete. I wonder if scripting would help somehow? dunno...

Anyhoo... I just updated my last post with the Javascript code... maybe someone will tinker with it and come up with a different solution and share it with the rest of us!

~Addam~

Link to comment
Share on other sites

  • 2 weeks later...

HA!!

I've got it!

Ok... here's the scoop! For some strange reason, FileMakerPro will submit all it's own forms between the [FMP-Record] and [/FMP-Record] before it submits anything else on the page that is after it. SO!!

Here is the following solution to submit multiple forms on one page at one time...

Javascript Code:

function editMe(){

var f=document.forms;

var size=1+[FMP-RangeSize];

for (s=0;s<size; s++){

f.submit();

time(1);

}

alert("This process may take a few seconds to complete. Please wait for the screen to take you back to your original view.");

}

function time(t){

var timme=t+1;

setTimeout('refresh()',timme)

//Refresh function refreshes the screen...

}

HTML Code:

<a href="#" onClick="editMe();">Done</a>

[FMP-Record]

<form action="FMPro" method="post" name="controls[FMP-CurrentRecId]" target="frame[FMP-CurrentRecId]">

<input type="hidden" name="-DB" value="[FMP-CurrentDatabase]">

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

<input type="hidden" name="-RecID" value="[FMP-CurrentRecId]">

<input type="hidden" name="-Max" value="25">

<input type="text" name="First Name" value="[FMP-Field: First Name]">

<input type="text" name="Last Name" value="[FMP-Field: Last Name]">

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

<input type="hidden" name="-edit">

</form>

<iframe name="frame[FMP-CurrentRecId]" id="frame[FMP-CurrentRecId]" height="1" width="1"></iframe>

[/FMP-Record]

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

<input type="hidden" name="-DB" value="[FMP-CurrentDatabase]">

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

<input type="hidden" name="-RecID" value="[FMP-CurrentRecId]">

<input type="hidden" name="-find">

</form>

For SOME REASON!! this works like a charm! When it's done, it will take you back to whatever format value you set above. You can get creative with some of the Javascripting and create like a "PLEASE WAIT!" window and when it's done, it goes away as the main browser refreshes to the new page.

Have Fun!!

~Addam~

Link to comment
Share on other sites

  • 1 month later...

After digging, I've come up with the proper way of doing this...

Set a field on the Form with the multiple records on it that are being changed called "times"... <<<--- I'll get back to that...

There is an <iframe> inbetween the [FMP-Record] tags...

The name of each one is: record[FMP-recid]; to keep them unique.

Set the width & height="0"...

There is a <form> in between the same[FMP-Record] tag with -find input tag in it along with the format page. (other stuff too if needed).

The name of the forms is: form[FMP-Recid]; to keep them uniqe.

Once you click on the submit LINK, a pop-up browser window will come up with a "PLEASE WAIT" (Blank HTML Document with some fancy text) <<<--- this is optional if you want to create this.

JavaScript will step through all the forms on the page and submit them in their own <iframe>...

Now the -format page is a blank document that only has JavaScript in the head. This will add "1" to a variable in a JavaScript function on the "Parent Form".

As it does that, JavaScript is incrementing the value by "1" and setting the results to the "times" field everytime it recieves "1" from the -format page.

(ex: 1...2...3...4 etc. [one value in the field at a time])

The reason for it incrementing like this is to get a handle on the server's processing of the records.

Now, all of this is running inside of a "Loop" in your JavaScript function. Everytime it cycles, it's checking to see if the value of the "times" field is equal to the [FMP-RangeSize] value (this can be used inside the JavaScript code as is). Once those two match, it will then run another function that will CLOSE the nifty "PLEASE WAIT" html document you've created and refresh the screen with the new information shown.

That's pretty much it in a nutshell!

Happy NEW YEAR!!

~Addam~

Link to comment
Share on other sites

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