Home
TeamSite
cgi callout + javascript
herald10
Hi,
I have a question about CGI callouts. When the CGI callout is performed a CGI window needs to be displayed with a text field in it. Once the user enters, a plain text file is to be updated with that value and the drop down on the DCT has to be refreshed with that value. The example from IW, just updates the item. But in my case a submit needs to be done on the CGI to update the contents of the plain text file and then do a callback. Can anyone tell me how to go about it?
Thanks
-H
Find more posts tagged with
Comments
jbonifaci
This should be pretty simple to do. The form update is handled via the javascript, I'm guessing on some button click. You just need to change it so that once the javascript updates the dct, instead of closing the window, it does a post back to the cgi. The cgi script then updates your file and writes back some quick html/javascript to close the window. Pretty basic cgi stuff.
herald10
Thanks for the reply. But the thing is, the dropdown in the DCT displays the values from a plain text field 'values.txt'. For the new value to appear in the DCT, first the file values.txt needs to be updated. That is my problem. Does that make any sense?
Thanks
-H
jbonifaci
I'm guessing that the field is populated with an inline? And then you have a callout that lets the user update the value(s)?
It shouldn't actually matter what order you do the update in from your callout. You could update the form first and then update the file. Or you could update the file first and then update the form. Both will yield the same result.
But if you do want to update the file first, just change the form to post to the cgi without calling the form update javascript. Then the cgi script will update the file and then output the html/javascript to update the form and then close the window. Same thing, just different order. Make sense?
herald10
Yeah. Thanks that clears the confusion. Sorry for my ignorance. Heres how I am planning to do it. The cgi script initially displays the text field and a submit button. Once submit is done, it updates the text file and then the form. Am I on right track? Please let me know.
thanks a lot for your help
-H
Migrateduser
This seems like it would be simpler to do with FormAPI. Is there a reason you don't want to go that route?
herald10
It didn't occur to me that we can use FormApi also. So basically I need to call a cgi oncallout event and take the input from user to post it back to the plain text file. And then refresh the item. Is my understanding correct?
Thanks a lot
-H
jbonifaci
Rob,
It sounds like he needs/wants a separate window that he can access from his dct and use to update the default values for a field. So he basically needs a cgi callout. He'll obviously be updating the values in the form with FormAPI, and I guess he could also do a callServer and call a separate script to update the text file that stores the value(s). But why would you want two scripts when you only need one?
~Jeff
Migrateduser
He described the interface in the callout as only having a single text field. I guess the bit that's open to interpretation is whether generating the text file is an actual goal of the process (the way I think you interpreted it), or just a step in updating the select list (the way I interpreted it). If your interpretation is correct, then yes, he will need two scripts, but I don't think there would be any definitive reason to prefer a cgi callout which updates the caller via formapi over having a text item and using an onItemChange event handler to update the dropdown and do a CallServer to create the file. Or vice versa.
Of course, I'm open to the possibility that I'm either completely misreading him, or just missing something that should be obvious.