close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

repeat selection breaks custom javascript code

Thread began 9/26/2018 11:02 am by s.joiner74419001 | Last modified 10/18/2018 2:46 pm by s.joiner74419001 | 108 views | 7 replies

s.joiner74419001

repeat selection breaks custom javascript code

I have a page where a user enters rows of data into a database using a web-form. The user has to enter a variable amount of data rows which is determined by a database value.

I have two alerts... One shows if they still need to enter a certain amount of data rows... and another if they have entered a sufficient amount. Because there needs to be a calculation to determine what alert is shown I have used a piece of javascript with data bindings to achieve this.

here is the code for the alerts and the javascript that performs the function.

<p id="incomplete" class="alert alert-warning incomplete">You need <span id="remaining"></span> more consenting leaseholders to qualify.</p>
<p id="qualify" class=" alert alert-success qualify"><i class="fas fa-thumbs-up fa-2x"></i>You have a sufficient amount of leaseholders to qualify for Right to Manage.</p>

<script>
var f = "<?php echo $row_rsCurrentUser['total_flats']; ?>";
var c = "<?php echo $row_rsCount['count']; ?>";
var r = Math.round(f / 2) - c;
var rq = f / 2;
document.getElementById("remaining").innerHTML = r;
document.getElementById("required").innerHTML = rq;
</script>
<script>
if (r <= 0)
{
$('#qualify').show();
}
if (r > 0)
{
$('#incomplete').show();
}

</script>

My problem is when I place a repeat selection to a form option field. It breaks the javascript and both the alerts show and the one which has a dynamic value in it is also not calculating.

I have other repeat selections on the page which don't effect it. Only when I add this particular repeat selection

I've attached the page if it helps. its possible you'll require remote access.

Thanks in advance

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...