Jump to content

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

Recommended Posts

Posted

Hi,

I am trying to improve a custom publishing CDML solution. The dbs consist of a main file and a related file. On the FMP layout of the main file there is a portal showing one or more related record. This is a data entry db and data will be entered in the main record and in the (already created) related records.

On the CDML page I display the data in a very similar way, showing, at the top, in one form the fields of the main file followed by the related record's fields in their own forms. So I end up having at least two forms per page, usually many more than that.

I was asked to make it so that all the forms can be submitted using a single button. This way the user goes through the data entry form, fills in some fields from the main record, certain fields from certain related records and sumits the whole thing using one button.

Is there a way in CDML to submit data through a relationship, the same way I would do on a FMP layout with a portal ? (the number of portal rows and the sort order varies)

Can I achieve this using and empty page with a refresh for each form in combination with some Javascript ? I definitely want to stay away from scripts.

ps I dont know much Javascript but I usually find my way around...

Thanks for the help.

Posted

I pretty much expected I'd have to use Javascript... But I am just learning Javascript and do not know about arrays. Can you, or another user, give me sample code or a source of imformation on how to do this ? I would really appreciate.

Thanks

Posted

If it is multiple rows of a Portal that you are editing you only need one Form for the whole lot (including the master record).

You use the Portal Row symbolism, e.g.:

myrelationship::myfield.[FMP-CurrentPortalRow]

etc.

All the best.

Garry

Posted

Garry, it sounds like exactly what I'm looking for !

You wouldn't happen to have a real life example ? or some text explaining what can be done using this syntax ?

I think I understand how this would work, it's pretty straight forward, but some refference material would be nice.

Thank you very much, I was about to give up...

Posted

Here you go:

<body><form name="edquotefm" action='FMPro' method='post' target='quote'>

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

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

<input type="hidden" name="-format" value="/digi_lan/editquote.html">

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

<table>

<tr>

<td><b>Quote ID:</b> [FMP-Field:quote_id]</td>

<td><b>Customer:</b>[FMP-Field:cust_name]</td>

<td><b>Date:</b> [FMP-Field: quote_date]</td>

<td></td>

</tr>

</table>

<table cellspacing="1">

<tr>

<th>Item ID</th>

<th>Item Name</th>

<th>Qty</th>

<th>Price ex</th>

<th></th>

</tr>

[FMP-Portal:quote_Id_rel]

<tr>

<td><a href="Javascript:showitem('[FMP-Field:quote_Id_rel::item_id]');">[FMP-Field:quote_Id_rel::item_id]</a></td>

<td>[FMP-Field:quote_Id_rel::item_name]</td>

<td><input type="text" name="quote_Id_rel::quanity.[FMP-CurrentPortalRowNumber]" value="[FMP-Field:quote_Id_rel::quanity]" size="4"></td>

<td>[FMP-Field:quote_Id_rel::sell_price_ex_tot_txt]</td>

<td><a href="Javascript:rmvrow('[FMP-Field:quote_Id_rel::rec_id]');">remove</a></td>

</tr>

[/FMP-Portal]

<tr><td></td><td><hr></td></tr>

<tr>

<td></td>

<td><b>Discount:</b></td>

<td> <input type="text" name="price_adjust" value="[FMP-Field:price_adjust]" size="4"></td>

<td>%</td>

</tr>

<tr>

<td></td><td><b>Delivery:</b></td>

<td>$<input type="text" name="courier_cost" value="[FMP-Field:courier_cost]" size="8"></td>

</tr>

<tr>

<td></td><td><b>Total Ex:</b></td><td align="right">[FMP-Field:total_price_ex_txt]</td>

</tr>

<tr>

<td></td><td><b>GST:</b></td><td align="right">[FMP-Field:gst_txt]</td>

</tr>

<tr>

<td><input type="submit" name="-edit" value="Update Quote"></td>

<td><b>Total Inc:</b></td>

<td>[FMP-Field:total_price_inc_txt]</td>

</tr>

</table>

</form>

</body>

"Quantity" is the editable value in each of the Portal Rows.

All the best.

Garry

Posted

The Function "rmvrow()" deletes a line item directly from the related file.

The Function "showitem()" displays the details of an item in a pop-up window.

They both submit Forms to achieve this.

All the best.

Garry

Posted

Gary,

I can see how this works when the portal rows are already created. What if the portal rows are not yet created ? I can't really create them in advance without using scripts. Is it possible to submit multiple new portal rows via the same submit as the main file's data (mixed -edit and -new)?

Because you see, I didn't mention in order to keep my question simple, but I am working with 2 portals here... and for every record already in portal #1, I display a -new form containing input fields that are in fact in portal #2 with default answers from portal #1.

Just to put you in context, it's a report entry solution on which I have main questions (from the main file) then a portal of "things to be reported" which I do not display on the web layout. The web layout displays a form to enter new records in the "already reported" db with values from the "to be reported" db for every record in the "to be reported"... so something like this ^_^

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

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

[FMP-Field:MainQuestion1]

<input type=text name="AnswerToMainQuestion1">

<input type="submit" name="-edit" value="Report">

</form>

[Portal: ToBeReported]

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

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

[FMP-Field:ToBeReported::Question]

<input type="text" name="Answer" value="[FMP-Field: ToBeReported::DefaultAnswer]">

<input type="submit" name="-new" value="Report">

</form>

[ /portal]

See what I mean. Is there a way for me to consolidate all of that in one form ? Considering the -edit action on the main report questions and the -new action on the sub-questions...

I think the whole thing would be much easier if the "AlreadyReported" records were already created, this way it remains a big -edit. Is there a way other than scripts to create as many records in one portal as there are in another portal upon creation of the main record ? I might resort to scripts if there is no other way but I have heard horror stories when more than one user trigger a script at the same time.

Let me know what you think and THANKS again for your help, it is most appreciated.

Posted

You can only create one Portal Row at a time with the ".0" naming convention and a "-edit". However, you may be able to use some php in conjunction with "-new" applied directly to the related file.

Good Luck.

Garry

Posted

cool ! Thanks for the tip !

So I guess I WILL use a script to create portal rows upon creation of the main record... this way I can do one big -edit and everybody's happy (especially my client)

  • 2 weeks later...
Posted

Hi all,

I'm in the process of switching to a single submit button as explained above. Everything seems to work fine as far as the script but the tag [FMP-CurrentPortalRowNumber] doesn't get parsed by FMP ?

I know it is a fairly new addition to the CDML... I am using FileMaker Pro 5.0v3 on windows XP (I now version 5.0 is not supose to be XP ready but I never had a problem with it). I have checked the spelling many times, even copied it from the CDML documentation.

Any idea why the tag is not being processed ? of course I am using it within the Portal tag.

Thanks for all the help !

Posted

Yes the other tags are being processed, all of them except CurrentPortalRowNumber.

Here is the code involving the portal (I removed the formatting for simplicity):

[FMP-Portal:ReportLineItems]

[FMP-If:ReportLineItems::Shift.eq.am]

[FMP-Field:ReportLineItems::Name] - [FMP-Field:ReportLineItems::Shift]

[FMP-If:ReportLineItems::CustomTextField1Status.eq.On]

[FMP-Field:ReportLineItems::CustomTextField1Name] : <input type=text name="ReportLineItems::CustomTextField1.[FMP-CurrentPortalRowNumber]" value="[FMP-Field:ReportLineItems::CustomTextField1]" size=30>

[/FMP-If]

[FMP-If:ReportLineItems::CustomTextField2Status.eq.On]

[FMP-Field:ReportLineItems::CustomTextField2Name] : <input type=text name="ReportLineItems::CustomTextField2.[FMP-CurrentPortalRowNumber]" value="[FMP-Field:ReportLineItems::CustomTextField2]" size=30>

[/FMP-If]

[FMP-If:ReportLineItems::CustomTextField3Status.eq.On]

[FMP-Field:ReportLineItems::CustomTextField3Name] : <input type=text name="ReportLineItems::CustomTextField3.[FMP-CurrentPortalRowNumber]" value="[FMP-Field:ReportLineItems::CustomTextField3]" size=30>

[/FMP-If]

[FMP-If:ReportLineItems::CustomNumberField1Status.eq.On]

[FMP-Field:ReportLineItems::CustomNumberField1Name] : <input type=text name="ReportLineItems::CustomNumberField1.[FMP-CurrentPortalRowNumber]" value="[FMP-Field:ReportLineItems::CustomNumberField1]" size=5> [FMP-Field:ReportLineItems::CustomNumberField1Unit]

[/FMP-If]

[FMP-If:ReportLineItems::CustomNumberField2Status.eq.On]

[FMP-Field:ReportLineItems::CustomNumberField2Name] : <input type=text name="ReportLineItems::CustomNumberField2.[FMP-CurrentPortalRowNumber]" value="[FMP-Field:ReportLineItems::CustomNumberField2]" size=5> [FMP-Field:ReportLineItems::CustomNumberField2Unit]

[/FMP-If]

[FMP-If:ReportLineItems::CustomNumberField3Status.eq.On]

[FMP-Field:ReportLineItems::CustomNumberField3Name] : <input type=text name="ReportLineItems::CustomNumberField3.[FMP-CurrentPortalRowNumber]" value="[FMP-Field:ReportLineItems::CustomNumberField3]" size=5> [FMP-Field:ReportLineItems::CustomNumberField3Unit]

[/FMP-If]

[FMP-If:ReportLineItems::CustomNumberField1OverCustomNumberField2Status.eq.On]

[FMP-Field:ReportLineItems::CustomNumberField1OverCustomNumberField2Name]: [FMP-Field: ReportLineItems::CustomNumberField1OverCustomNumberField2WEB]

[/FMP-If]

[/FMP-If]

[/FMP-Portal]

Posted

According to the Tech Note FM has a bug eveluating the [FMP-CurrentPortalRowNumber] tag between [FMP-If] tags.

Here is some Javascript to use as a workaround:

<script>CurrRowNum = "[FMP-CurrentPortalRowNumber]";</script>

[FMP-If:ReportLineItems::CustomTextField1Status.eq.On]

[FMP-Field:ReportLineItems::CustomTextField1Name] :

<script>document.write('<input type=text name="ReportLineItems::CustomTextField1.' + CurrRowNum + '" value="[FMP-Field:ReportLineItems::CustomTextField1]" size=30>');</script>

[/FMP-If]

Hope this helps.

Garry

  • 2 months later...
Posted

Hi Garry,

I am curious to know if it is possible for the fields in the portal to have value lists attached to them as some fields that need editing are reliant upon the values in the value list.

Posted

You may need to access those value list directly from the related file. This is because "Related ValueLists" do not work through WebCompanion.

You may need to use [FMP-InlineAction] tags to achieve this.

I will be unavilable until mid-next week. I will be able to have a closer look then.

All the best.

Garry

  • 1 month later...
  • Newbies
Posted

Actually, you can pull in these values via a calculation field utilizing "valuelistitems". This is a bit messy but works to insert related valuelists via CDML & CWP.

In the child file, create a text calculation field (c_student_opt) for the value you need to have displayed in your list, like so:

"<option value=field_name_4_list> field_name_4_list </option>"

Now create a valuelist (student_list) within the child database based upon the common key or info linking the related records (this will only work in the child, not parent).

Next, create another text cacluation (called student_list): "valuelistitems("child_dbase.fp5","your_valuelist")

Finally, don't forget to insert the calculated value list (student_list) onto the layout in the parent.

This you then can use in your portal:

<select name=relationship_name::student.[FMP-CurrentPortalRowNumber]>

<option selected value=[FMP-field:relationship_name::student]> [FMP-field:relationship_name::student]</option>

[FMP-field:relationship_name::student_list,raw]

</select>

note: don't forget the ",raw" format tag for the valuelist to allow the "html" of the field to render correctly.

  • Newbies
Posted

In regards to creating new records, I've had more success in creating multiple records via inline action tags than with adding the .0 (zero) portal row tag. I have seen the .0 method overwrite data or behave strangely if more than one web user is performing the same task. It was not predictable when the error would occur.

I begin by asking for the user to tell me how many records they want to add on page 1.

Then on the following page I use an inlineaction to check the current number of blank records already in the file (just in case) and then create the necessary number of new blank records via inline actions - inserting any information I want to automatically fill in like the user's ID, to know who created the records or similar info.

Then while on the same page, I find the blanks in a portal via an inlineaction and edit the records in a portal. This confirms that the related records are indeed created with unique record id's and with no possibility of overwriting existing information. The web user never sees the multiple tasks and only has to interact with two pages.

I like to avoid the use of FMP-scripts due to the locking of FMP during the script(s) operation, making your CWP pages inaccessible to the web. That is why I use the inlineaction tags in lieu of FMP-script. Once I find time to learn Java, I might look into record creation in that way, but most likely I'd use php instead.

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