close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

repeat selection breaks custom javascript code

Thread began 9/26/2018 8:02 am by s.joiner74419001 | Last modified 10/18/2018 11:46 am by Ray Borduin | 1754 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

Sign in to reply to this post

Ray BorduinWebAssist

I'll need FTP access, a URL to see the problem, and steps to reproduce in order to help debug something like this.

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

s.joiner74419001

Thanks Ray. See PM

Sign in to reply to this post

Ray BorduinWebAssist

Debugging custom code is a bit beyond what I can do over the forums. If you want help with this, please sign up for a premier support ticket.

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

s.joiner74419001

Ray I eventually solved the issue, not quite sure why but it was an issue with the recordset being used for both the select field and the repeat region. I created a separate recordset for the selection field and it solved the issue.

Unfortunately I'm still having a problem with an update behaviour which uses the select field in the form.

The Update behaviour is triggered by an access rule ( named "multiblock" that is dependent on a URL parameter value ( blocks=2 ). The update behaviour is triggered but the binding used does not seem to work. the binding uses the value from the selection field “block” ( which is chosen by the user ) from the “consent_collation” form . The selection field uses a repeat region to display all the options ( there is currently 2 - ‘Block A’ and ‘Block B’ ). I wonder if its an issue with the options within the repeat region!

Its an issue with the binding in the option selected. Because if I just put in a static number in the “Binding Value” it works.

You can use the same access I gave you in the previous PM.

Ive put database access in this PM if you need it.

Thanks in advance.

Sign in to reply to this post

Ray BorduinWebAssist

How is the blocks url parameter added to the URL to initiate the insert? My guess is that the form isn't being posted when that happens, so the binding doesn't have a value.

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

s.joiner74419001

Ok.. So Its added from other 3 update behaviours that sit before that add the email. Email value uses 3 update behaviours because the email owner differs depending on other form selections. the 'blocks URL parameter' is added to the redirect URL in these three behaviours.

Sign in to reply to this post

Ray BorduinWebAssist

So if it is part of a redirect then the form POST values won't exist after the redirect. The best option would probably be to add the "block" form post value to the redirect as well and use $_GET to reference it, or save the value to the SESSION so that it will persist after the redirect.

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

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