close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

where should framework builder function to be called on success reside

Thread began 1/24/2023 2:00 pm by asarcona308398 | Last modified 1/29/2023 12:28 pm by Ray Borduin | 353 views | 10 replies |

asarcona308398

where should framework builder function to be called on success reside

Hey Ray,

I have a load plugin to div page that does load in, but a function to populate a select box don't seem to trigger "on success". I tried to relocate the function onto either page and nothing seems to work. I am using the 'functionname()' as the function to call on success without any luck.
I am $_POST in values into the plugin page to run a Query which works... I have Show if's applied which work if query returns/ or not... they also work...

Should I be naming the function in a certian format ie. 'name' or 'name()'... or in my case 'intervals(startString, endString)' ....i have tried all and nada!

The plugin page will work on it's own when not brought in as plugin.

Any help appreciated.

UPDATE:

It seems that if any function is called I recieve this errer in DevTools....

Uncaught TypeError: on_success_start is not a function
at pluginxmlHttp.<computed>.<computed>.onreadystatechange (ajax.js:66:9)
pluginxmlHttp.<computed>.<computed>.onreadystatechange @ ajax.js:66

XMLHttpRequest.send (async)
framework_ajax_plugin @ ajax.js:127
framework_load_plugin_url @ Menu_dev.php:22
onclick @ Menu_dev.php:75
ajax.js:127 XHR finished loading: POST "http://localhost/bootstrap/webassist/framework/ajax_wrapper.php?plugin_from=localhost/bootstrap/Menu_dev.php&plugin_file=cGx1Z2lucy9vcGVuY2xvc2VkLnBocA==".
framework_ajax_plugin @ ajax.js:127
framework_load_plugin_url @ Menu_dev.php:22
onclick @ Menu_dev.php:75

remove the function called and all is good

Attached Files
Base.zip
plugin.zip
Sign in to reply to this post

Ray BorduinWebAssist

Try:
framework_load_plugin_url('plugins/plugins/plugins/openclosed.php',document.getElementById('openclose'),'openclosed-modal-plugin','',intervals);

The on_success_start has to be a literal function, not the name of the function as a string. You can't pass arguments, so you'll have to set those outside of the onchange event.

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

asarcona308398

Hey Ray

When you say the on success call has to be a literal function this is what is being called

<scr..
function intervals(startString, endString) {
var dropdown = document.getElementById("selectNumber");
var start = moment(startString, 'hh:mm a');
var end = moment(endString, 'hh:mm a');
start.minutes(Math.ceil(start.minutes() / 15) * 15);
var result = [];
var current = moment(start);
while (current <= end) {
result.push(current.format('h:mm a'));
current.add(15,'minutes');
}
for (var i = 0; i < result.length; ++i) {
// Append the element to the end of Array list
dropdown[dropdown.length] = new Option(result[i], result[i]);
}
return result;

document.getElementById(intervals( '09:00' , '22:00'));
}
.../>

I have tried adding... framework_load_plugin_url('plugins/plugins/plugins/openclosed.php',document.getElementById('openclose'),'openclosed-modal-plugin','',intervals);
directly and no change... I have tried to place the script on both pages without any luck... the script works, but i can't seem to get this "load to Div" to work ...

Any chance you might have pages that show the load to Div plugin calling a function on success?

Sign in to reply to this post

Ray BorduinWebAssist

If you send me ftp credentials and a url to a page where I can test then I'll take a look and debug what you are working on.

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

asarcona308398

this is off network development Ray

Update: I'm going to try to change the script some... the page may be calling the select element before it is there throwing the:

Uncaught TypeError: on_success_start is not a function
at pluginxmlHttp.<computed>.<computed>.onreadystatechange (ajax.js:66:9)

error.... I'll keep you posted
Thanks again Ray

Sign in to reply to this post

asarcona308398

Hey Ray

What I found is that the page that has the onClick event, has to also have, the function, and in my case, the element that the function acts on to work.
Am I correct in believing that the 'load to Div' page doesn't process the function for that page?
The reason I ask is because I am trying to call in a page, that has a function on it, that would be used and displayed on that plugin page ...
but if the element is on that plugged in page it does not work.
Is that doable?

Thanks Sooo much for your time!
Tony

Sign in to reply to this post

Ray BorduinWebAssist

I've never done that, but It seems like if there was a <script> tag it would run. I'd have to debug to be sure. Can you just move it to the main page?

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

asarcona308398

Hey Ray

It seems I might be taking shortcuts in my development process!

If I move the script to the main page I get this error in DevTools:

Uncaught TypeError: Cannot read properties of null (reading 'length') Menu_dev.php:1012
at intervals (Menu_dev.php:1012:25)
at Menu_dev.php:1016:25

this is from the called script which is using a php variables for time, I would hope they're available as the script runs after php!
I am still keeping the element used in the script on the plugin page here though.
If I move that element to the main page, the script acts on the element on the main page load, and no errors!
if I then call the onClick event to bring in the plugin page with the element on plugin instead, the plugin page shows an empty element, a selectbox in this case.

I'm thinking it might be a DOM issue when the page loads and the script having to reside on the main page
really can't access the plugin page because when the script and element are on plugin page it breaks??

I've run a simple function like:

<p id="demo"></p>

<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Hello World";
}
</script>

and it works.. loading "demo" on the main page before the modal that I call with onClick loads the plugin page.. I get the same results if I try to get that to run on the plugin page...it don't seem to write to the plugin page.

I'm thinking I may have to plugin to the plugin page the script, then plugin that page to the main page...if that makes any sense!

I've attached the files with the 'intervals' script on the main page and the element on the plugin page that will produce the error and blank selectbox,
the DB file as well.


Just a note... when adding the name intervals in Load toDiv wizard, it puts it in '' and it wont work.... your suggestion of removing them on the onClick event
does enable the script to go further.

If you find time to look I will be available...

I think a session may be best to see what is going on...

Let me know..

All the best

Tony

Attached Files
Menu_dev.zip
openclosed.zip
storehours.sql
Sign in to reply to this post

Ray BorduinWebAssist

Yes I'll probably have to debug it live to figure it out. If you want to give me a call we can do a screen sharing session.

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

asarcona308398

PM

Sign in to reply to this post
loading

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