Comments (5)
To be clear both image entries are created, but only the first id gets passed through to the hidden input.
from sections_event.
Given this HTML
<input name="images[]" value="v1,v2,v3"/>
in PHP you will get an array called images
and the element with first index 0
will contain the data:
$_POST['images'][0] === 'v1,v2,v3'
Given this data, SBL field will store only v1
. (see this line)
Given you want to link multiple entries, you have to pass them as elements of the array:
$_POST['images'][0] ==== 'v1'
$_POST['images'][1] ==== 'v2'
$_POST['images'][2] ==== 'v3'
So in HTML you will need something like this:
<input name="images[]" value="v1"/>
<input name="images[]" value="v2"/>
<input name="images[]" value="v3"/>
Applied to your example, you will need
<input name="sections[listings][images][]" type="hidden" value="%images[0][system:id]%"/>
<input name="sections[listings][images][]" type="hidden" value="%images[1][system:id]%"/>
=> in PHP
$_POST[listings][images][0] === %images[0][system:id]%
$_POST[listings][images][1] === %images[1][system:id]%
from sections_event.
Sorry, I posted the wrong code. I'm actually using:
<input name="sections[images][0][image]" id="sections_images_0_image" type="file">
<input name="sections[images][1][image]" id="sections_images_1_image" type="file">
<input name="sections[listings][images]" id="sections_listings_images" type="hidden" value="%images[0][system:id]%,%images[1][system:id]%">
I'm not trying to pass an array for multiple listings
entries. I am creating one listings
entry with many images
. Basically it should be the same as the Readme's Example 4 (books and authors):
My SBL has multiple selection enabled, so it should receive the IDs of both image entries, but something is not going through.
from sections_event.
Ah ok, I got it. So the behavior of SBL for multiple selections is to pass an array, not a comma separated list.
I got confused by Example 4. Assuming Example 4 is passing the IDs to a SBL and not a text field, then shouldn't it also be passing an array of values?
from sections_event.
So the behavior of SBL for multiple selections is to pass an array, not a comma separated list.
Yep.
I got confused by Example 4. Assuming Example 4 is passing the IDs to a SBL and not a text field, then shouldn't it also be passing an array of values?
You are right. Thanks. Fixed it in this commit.
from sections_event.
Related Issues (15)
- Event filter support HOT 7
- Problems when saving special characters HOT 6
- Inserting POST values with an event before Sections Event HOT 3
- Different filters on different sections? HOT 5
- Mutliple sections and Reflection Field HOT 22
- Sections Event and latest members not working HOT 4
- Sections Event without Members extension? HOT 3
- Errors with 1.4 HOT 7
- Weird validation errors HOT 2
- Same problem again as issue #2 with latest update HOT 5
- Feature request: custom validation messages HOT 2
- Files not uploading once again HOT 1
- Validation for multiple sections doesn't work HOT 5
- Suggest Feature: Something similar to Fingerprint extension HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sections_event.