With the LBF/LBT forms. I can modify the plugin php file and execute javascript code when the page loads. But the form frame work puts an onsubmit function in the generic template part of the forms. I wanted to add something to the onsubmit function, but i don’t want to add it to the framework because it only applies to one form. Is there a way i can append something to the onsubmit frunction from the plugin file?
ah ok. With LBF forms each form has it’s own code base - interface/forms/ - so presumambly that would allow you to add code to your form if it was created as an LBF form - but that’s more work than using the LBT framework.
i wonder if you could use the modules framework to achieve this with LBT forms. your code could distinguish between different forms.
another thought - have you explored the conditional coding in the LBT form - activated when one clicks on the “?” to the right of the field when it’s being set up? at a quick glance it might need modifying to include the option of a time stamp though - or maybe a field that is filled in with the time stamp when your text field is completed - but that’s not quite the same as concatenating the timestamp to the text…
The lbf and lbt forms have their design data stored in database tables. The module then creates the forms from the data in the database. You can use a plugin file located in /site/default/LBF to do javascript when then form is generated by the module. The file that generates the form from the design data has an onSubmit javascript function. But messing with that function will mess with the onSubmit for all lbf and lbt forms.
I may have to just put an if statement on the onSubmit to check which form is being submitted and do the appropriate thing with that.
I was mostly just asking, in case there was a procedure for doing what i wanted done and I just didn’t know about it. It doesn’t appear as though there is so I’ll work around things to get done what i need done.
ah interesting, i didn’t know about these plugins - that’s useful to know.
it looks as though the files in the folder sites/default/LBF are for specific lbf forms, so would get over the problem of affecting all forms. on my own test system there seems to be a modified onsubmit for the plug in for the gcac form, but i think you understand it better than i.
yes, putting an if statement to check which form is being submitted would work. this means you’d need to use your own version of the file every time you install a new version of the code, i.e. on patches and code releases, or reaply your fix if the base code for this has been changed. This is why i suggested using your own module - they’ve been developed for just this kind of situation. are you familiar with these? (e.g. the menu modules/manage modules refers to user specific modules)
there may well be a better solution, but as you say, no one else has replied with one!!.
I see what was done in the LBFgcac.plugin.php file. It appears as though they are hijacking the form’s onsubmit and changing it their own version. That’s not a bad way of doing it.
Thanks for pointing out this file. I never noticed it before.