Jump to content

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

Recommended Posts

Posted

Thanks to gary i could get a start with a code to create multiple records in one submit.

The code looks likes this:

<script>

function subForms()

{

nAllForms = document.forms.length;

for (i=0;i<nAllForms;i++)

{

document.forms.submit();

};

}

</script>

Hello World <BR>

[FMP-InlineAction: -db=test.fp5, -lay=L1, -FindAll]

[FMP-Record]

[FMP-Field:Key]<BR>

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

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

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

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

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

</form>

<iframe name="frame[FMP-CurrentRecordNumber]" id="frame[FMP-CurrentRecordNumber]" height="10" width="10"></iframe>

[/FMP-Record]

[/FMP-Inlineaction]

<a href="#" onClick="subForms()">Submit</a>

What it should do is create as many records as found in the inlinecode.

However, when i press the submit button only one record is created.

The for loop runs only one time.

Could someone give me clue what i am doing wrong

(* thanks again gary *)

Jitse

Posted

Jitse,

This code should work OK.

<script>

   function subForms()

       {

        nAllForms = document.forms.length;

      for (i=0;i<nAllForms;i++)

               {

                document.forms[i].submit();

                };

        }

</script>

What does the page source look like after the page has loaded. Do you see more than one Form and iFrames?

All the best.

Garry

Posted

Thanks garry for your attention,

After pulling my hair out ( well after first finding some hairs and then pull them out) i have been playing with the browser type. and guess what : explorer 5.5 under OS 9.2.2 did not work, explorer 5.5 under jaguar did not work : With safari it work.

Thanks again for the code,

Jitse (bow)

Posted

OK garry,

the code is now working as lightning.

This however seems to have created another problem (at least i think).

This is the situation.

I am testing the code on my LAN (an 3 years old imac is hosting the database) my TiBook is a client.

Now each time when i hit the submit button the routine should create 5 new records. I have been testing this and randomly it sometimes happens that only 4 records are created.

Now it could be that the submit loop is to fast for my imac to follow the requests.

I mu suggestion right about this : could it be that my fm 5.5 host misses requests from a client when the requests are generated in a for loop.

If not : well than i have to look in my code offcourse (as usually)

I so : should i build in a pause in my for loop

Thanks

for any response

Jitse

Posted

You could try something like this to slow it down:

<script>

   function subForms()

       {

        nAllForms = document.forms.length;

      for (i=0;i<nAllForms;i++)

               {

                setTimeout("document.forms[i].submit()", 500) ;

                };

        }

</script>

This should wait half-a-second between submissions.

Good Luck.

Garry

Posted

Garry, a point of information, please.

If the time were reduced to 5 from 500 would this work just as well? Half-a-second between submissions makes a 2 second submission - not that that is especially long or anything. I'm just curious how a pause works from the client side in JavaScript.

I've observed that the "pause" in a ScriptMaker event sometimes can be useful when set for :00.

Thanks.

Posted

I once was trying to submit 2 forms with JavaScript and I wasn't successful.

It was working OK if I put alert box between the 2 submits. Even with 2 seconds delay the second submit didn't worked. So I did that in Lasso and it was working OK.

Posted

I have been doing some testing with no "setTimeout()". I am processing 30 Forms. My format file is very simple with one word "done".

I am using a pBook with FM6 at "localhost". I have been having different results with different browsers. Safari has been mostly fine NN and IE have problems.

The only problem I have run into so far with Safari is an error returned occasionally with "Maxium Licensed Users Clients reached". Which is just me as localhost.

I think a simple format file is important.

I will do some testing with "setTimeout()" next week. I am travelling this week.

All the best.

Garry

Posted

Dear Anatoli, Garry,

I sure think that multiple submits in a js loop is a verry important issue. I do not hope that i well get in trouble using CDML.

I have never used lasso so i do not know the difference between Lasso and cdml but i doubt that cdml nor lasso has anything to do with the issue of the multiple submits.

I think it is related to the speed of the host and more the buffering of incomming request.

Just a thought : but what happens when a request is submitted while another one is still being processed. If FM is truly multiuser then that should not be a problem. FM should cache one request while finishing another request.

Or is it the case that lasso gets an reply from filemaker that it has finished the first request and the client can safely intitiate the next request : meaning that lasso waits for the next request until the previous one is finished.

I know that i do not have any answers but it all makes me remind that i should take a deeper look at the host to see if that s given any troubles.

Looking forward for any deeper thought,

mean time i will also do some experimenting

Jitse

Posted

In Lasso it is different story altogether. FM CDML has around 110 commands, Lasso more than 800. And you can create your own custom tags.

Lasso can pass everything from single form to next page for Inline processing. You can test in Lasso which button was pressed etc. You can loop in Lasso based on how many records should be updated in FM or in LassoMySQL.

I did 4 or 5 nice systems in CDML, but after 1 month with first Lasso project I do not want to go back.

Posted

Hello Everyone,

Me too.

I don't really want to leap into this rarefied atmosphere, but I think I need to do something similar to what Jitse wants. In fact, don't lots of people wish they could create multiple records?

So do I have to learn Lasso to accomplish this? Will Lasso let me do something that will work when CDML would not work? I don't even know how to get started with Lasso.

Posted

I recently had a similar problem where I needed the system to perform several tasks upon the submission of a form.

I don't like the idea of using FMP scripts through the web so I stayed away from that. (I know some people will argue that there is nothing wrong with using scripts through the web if done right but I decided against).

I considered JavaScript but not being too JavaScript-literate and being in a bit of a rush, I opted for a less elegant solution: refresh tags.

Upon the submission of a form I needed FMP to create a record, find a record in another DB, modify that record then perform a search in another DB and display the found record. I guess, if necessary, you could use the same ugly technique to create several records.

The submission of the form would create the record, sending the user to a html format file containing only a refresh meta tag with the next inline action in the url, which in turn sends the user to another html format file with a refresh meta tag that performs the next action (find a record in another DB) and so on...

While being quite ugly compare to JavaScript, this method worked fine with any browser that supports refresh and allows for a script-like sequence of any action in any DB... if you don't mind the blinking a the screen...

I would be interested to know what you all think of this method, the problems you are foreseeing, limits and other thoughts... just wanting to make sure i'm not shooting myself in the foot...

Cheers

Posted

I am using combination of that and JavaScript combined. If pages are blank with white background, IE even doesn't blink.

That was in my pre-Lasso programming.

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