please help me i have a field in my form “diswm” .i created an agent that i call from button the agent is written in LS and i use JS code inside of it , now my problem is passing the value to field “diswm” throw the JS confirm
It cannot work like that. Similar problems have been dealt with in this forum frequently, even within the last two days. Do a search.
One problem is, that DocumentContext is NOT your current web document. It’s the current in-memory document when the agent runs. For an agent called by URL command, this is a brand new doc, containing CGI fields, but none of the fields of your web document.
Also, the only output options for your agent using print statements are either to redirect to an existing resource, or to print out a completely new web page. Even if your document already existed in the database, so you could grab it, update it in the back-end and then redirect to that doc would not solve the problem. As your current (HTML) form is not submitted, all unsaved changes would be lost.
The general question is, why you are calling an agent to execute JavaScript anyway. Is there some more logic, which you stripped out to shorten the example? If not, just put your JS directly into the button and it will work straight away.
Your JS code could also submit the form and some WebQuerySave agent (which has access to the current document through DocumentContext could do further processing.
If you tell us a bit about what your final goal is, we can provide more on topic help.
sorry if i keep posting the same Q. over and over . but belive me i have been trying to solve this problem for almost a week now. and i have been doing researche for similer problem all over this site , reding javascript codes and trying evrey idea had been send to me . so please be more patient my final gool is to get the value of the LS field “diswm” and change it to “1” when JS(confirm) is true , use this field “diswm” to call another finction in my agent (LS notification function ) thats my gool
Put your JS code right into your button (and don’t forget to add a semicolon at the end of each line.
var askme;
askme = confirm(“Hi”);
if (askme == true) {
this.form.diswm.value = "1";
}
Possibly submit your form with the same button.
this.form.submit();
Put your LS processing logic in a LotusScript WebQuerySave agent.
diswm must be accessible by JavaScript, that means it must not be hidden using Notes hide-when-formulas, unless the form property to generate HTML for all fields is set.
Well, I thought so. Unfortunately, I’ve come to the conclusion, that the whole architecture of your application seems to need a major redesign.
The base line is: You cannot (easily) have (front-end) JavaScrip code interact with (back-end) agents. It sort of could be done using either AJAX or iframes or 0 pixel frames. But this would all require a level of JavaScript knowledge that - forgive me if I’m wrong here - you seem not to have at the moment.
So, don’t expect any meaningful help on what you’ve tried so far. Too much guessing, too little info about what business need you have to fulfill. Sorry.
Mentioning many posts in that the confirm(“Hi”) message was in fact just a placeholder for another piece of code isn’t really going to help get any answers or guidance!
Talk briefly about why you want to do this. There may be a better way to do it than what you are trying.
and
Think a moment before you submit your post. Put yourself in the place of someone trying to answer your question. We know nothing about your issue except what you tell us. Have you really said enough for someone to understand your situation? Have you used unambiguous wording? Have you used the standard terminology?
hello guys maybe my problem is biger than i thought . i will not add any more detail to any new message ,but simply i just need some athor approch . the problem is the cofirm method that will work on the web throw LS agent and i need the return value of the confirm OK/CANCEL if OK i will call another function in my agent
now if all of you guys cant add anything more . in advance thanks for all of you ,and if i find a way i will let you all know shatha
You can;t keep posting the same question time after time
Take the time to read the thoughtful, considerate responses that people have posted and maybe change your approach. You seem hung up on having to do this in JS but don;t offer any reasoning why.
As Harkpabst says, more info about the final goal will probably help people help you
i have tried evrey thing belive me . 1 tried to change the LS “diswm” field throw the JS code by using documents.fomrs[0].diswm.value= 1
2 i tried it to change the value by calling another agent location.href=“…/agentname/?openagent” and it did not work becouse the child agent will not run until the parent agent is finised 3 i have been trying belive me i have
4 SIMPLY my gool is to change the LS field after confirmJS is true to call LS function in same agent(notification function)