Save or edit success response, run function, with button and not IOL.

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

I can get this to work doing it through image onload and I think its great but for some reason they want to choose when this functionality happens and I'm trying to do that. Basically I need to have one button that will save or add and then run a function. If I put the redirectVal to the js it just loads the text and when I do HTML I lose all the libraries like Jquery and things like kRid. Any suggestions on how to do this? I had this working but they don't want the save button hijacked. Any help is greatly appreciated. Thanks. Below is my code

http://pastie.org/10896764 

Photo of itsjustchuck

itsjustchuck, Champion

  • 80 Points 75 badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of itsjustchuck

itsjustchuck, Champion

  • 80 Points 75 badge 2x thumb
one solution I'm thinking of is having the button populate a field like a 1 and if thats a 1 run the script otherwise ignore it but not sure best way to do that since its not quite working
Photo of itsjustchuck

itsjustchuck, Champion

  • 80 Points 75 badge 2x thumb
ok i got this working. so to do this I add a field to hold a number and this is my buttons onclick

onclick=\" var counter = +$('#_fid_408').val() + 1;$('#_fid_408').val(counter);$('#saveButton').trigger('click');\"

then inside my script i grab this fid value and if its 1 i run it, otherwise it doesn't run. This is not ideal way but I have to do it a specific way and this was how I was able to accomplish it.
Photo of itsjustchuck

itsjustchuck, Champion

  • 80 Points 75 badge 2x thumb
So this is just what I ended up doing for a similar issue and wanted to share in case anyone could use any snippets of code from it. If you have questions feel free to reach out.



Basically it tries to grab any the values i need from the pages field values it can. Then anything it needs to get from the record thats about to be added, it saves and queries the new record and another record from another table for values and adds some them to an addRecordObj. Then at the end uses that object to add a record in another table.

http://pastie.org/10900341