close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Repeat Selection and Insert Multiple Records Solution

Thread began 3/23/2022 8:12 am by s.joiner74419001 | Last modified 3/24/2022 1:49 pm by Ray Borduin | 269 views | 4 replies |

s.joiner74419001

Repeat Selection and Insert Multiple Records Solution

I have a section of a form that gives information on Flat / Apartment blocks if there is more than one block. There is an input field that firstly asks how many blocks at the property. This value can be between 2 and 8.

html:
<input type="number" class="form-control" id="blocks" name="blocks”>



I would like to use this value as the dynamic value for a repeat selection below it. The repeat selection will have two input fields repeated: 'Block name' and 'Block Numbering'. So for example if the input field above has the number 4. The two fields in the repeat selection will be repeated 4 times.

See attached screen shot to see how it looks using a static value of 8 for the repetitions ( 8 is the maximum accepted )

<div role="group" class="row block-details" area-labelledby="block-label">
<?php
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_None){
?>
<div class="col-md-6">
<div class="form-group row">
<label for="blockName1" id="block1-label" class="sr-only">Block 1 name</label>
<div class="col-lg-6 col-xl-7">
<input class="form-control name" name="block_name_1" id="blockName1" placeholder="Name of block 1" >
</div>
<label for="blockNumbering1" id="numbering1-label" class="sr-only">Block 1 numbering</label>
<div class="col-lg-6 col-xl-5">
<input type="text" class="form-control" name="block_numbering_1" id="blockNumbering1" placeholder="block 1 Numbering i.e 1-9'" required="" >
</div>
</div>
</div>
<?php
} // RepeatSelectionCounter_1 Begin Alternate Content
else{
?>
<?php } // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
if(!$row_None && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_None = mysql_fetch_assoc($None);
}
?>
<?php
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
</div>



My problem is when I change the ‘repetitions value to a dynamic value using the ‘blocks’ input’ .. It doesn’t work.

php:
<?php

    
// RepeatSelectionCounter_1 Initialization
    
$RepeatSelectionCounter_1 0;
    
$RepeatSelectionCounterBasedLooping_1 true;
    
$RepeatSelectionCounter_1_Iterations "".((isset($_POST["blocks"]))?$_POST["blocks"]:"")  ."";
?>



What’s wrong here?

Plus is it possible to create placeholders dynamically so they are numbered correctly for the amount of repeats.
(Page attached)

Thanks in advance!

Attached Files
rtm-application-form - Copy.php
Sign in to reply to this post

Ray BorduinWebAssist

I think you are mixing client and server code. The fieids are on the same page... are you expecting the number of rows to update as you update the field? That would have to be done with javascript, not php.

If you had the blocks field on the previous page that submitted to this page, then the code would work.

Sign in to reply to this post
Did this help? Tips are appreciated...

s.joiner74419001

Thanks Ray.. Yeah i'm getting mixed up. I'll have a re-think. Cheers!

Sign in to reply to this post

Ray BorduinWebAssist

This is something I could help with in a premier ticket if you want. It may be difficult to pull off without some custom code, but shouldn't take too long for someone that can write javascript to duplicate the rows in the browser.

Sign in to reply to this post
Did this help? Tips are appreciated...

s.joiner74419001

I've managed a workaround for now similar to the setup on the current site which will do for now. I'll more than likely get your help under a support ticket as I will also have other work Ill need your help with which is integrating Stripe into our e-cart setup. I'll message you on a new post regarding that.
If it works better to keep these separate then thats fine just let me know!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...