When you pass parameters to a shortcode, you are passing key/value pairs that are stored in the @atts array. This is how the WordPress Shortcode API works. So when you pass 96=1058 or any variation thereof, you are literally asking the shortcode to calculate a value where field 96 equals 1058. While I don't understand entirely what you want to do, your question raises curiosity in my mind about your design. If you want to count what's in the current form, why don't you just count what's in the current form? What is the second form for and why do you need to link it back to the current form? Do either of these forms serve as the single source of truth for the values you want to calculate?
<p>Hi Victor, thanks for your reply. I’ll try to articulate a bit more clearly. I have a form (Form 1) which has 3 fields being ID = 96, 97, 98. This table has several hundred lines of externally loaded data. My second form has corresponding cascading lookup fields, being 109, 110, 111, in the form of dropdowns. However, when there are no available options for the user to select from in field 111, I don’t want that field even shown to the user. In other words, I want it hidden until the user has selected from the dropdown values of fields 109 and 110, then unhidden if 111 has any values to select from. I was planning on having a hidden field (eg field 120) that calculated the number of options in the 111 dropdown, then using conditional logic to unhide field 111 if that value was >0. But I can’t work out how to calculate the number of dropdown options in field 111. The calculation of [frm-stats id=98 type=count] successfully returns the total number of options, but doesn’t take into account the cascading/filtering. So I want to include the cascading selections as filtering options in this calculation, such as [frm-stats id=98 type=count 96=”109 selection” 97=”110 selection”]. However, I don’t know how to represent the 109 selection when using the frm-stats code. Normally I would just use [109], but it does not work in this case.</p>
Interestingly, the following syntax, which I've used in another form, does work:
[frm-field-value field_id=1094 user_id=current 142=1098] - where fields 1094 and 142 are in another form and field 1098 is a field in the form currently being completed by the user.
However, the same syntax does not work for frm stats, ie: [frm-stats id=98 type=count 96=109] - where fields 98 and 96 are in another form and field 109 is in the current form. If I delete the 96=109, then it calculates, but without the filter.
Unless I'm missing something, there seems to be an inconsistencies between the syntax.
You shouldn't expect two different shortcodes that provide completely different functionalities to work with the same parameters. frm-field-value is used to get the value from a single field entry and display it in a page, post, View or form field. This can be particularly helpful in auto-populating forms for your users.
frm-stats is used to display field totals and form statistics in a page, post, View, or anywhere else shortcodes are accepted.
<p>So what I'm hearing from you is that there is not a way to filter the frm-stats count function when using it in a default value calculation?</p>
Please login or Register to submit your answer