HELP PLZ very important

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

this my agent please help me am dispirit

Set webdoc = s.DocumentContext

Print "<Script Language='Javascript'>"

Print {var askme}

Print {askme=confirm("Hi")}

Print "if(askme== true){document.forms[0].diswm.value = 1}"

Print "</Script>"

test=webdoc.GetItemValue( "diswm" )(0)

Call webdoc.save(True,True)

how to change the value of the field and how to save it

Subject: HELP PLZ very important

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.

Subject: RE: HELP PLZ very important

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

Subject: RE: HELP PLZ very important

So why don’t you simply set the field using JavaScript?

Subject: RE: HELP PLZ very important

and how can i do that . you mean inside the JS codecan you give me more details

Subject: RE: HELP PLZ very important

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.

Subject: RE: HELP PLZ very important

the confirm(“Hi”) is not the real message . i get the value of the confirm message from another function LS in that agent so how can i do it

and by the way i did use

form.submit();

and it worked for one time only and when i tried it again nothing happen .

Subject: RE: HELP PLZ very important

“the confirm(“Hi”) is not the real message”

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.

Subject: RE: HELP PLZ very important

Harkpabst,

I came to the same conclusion as you did i.e.

“Too much guessing, too little info about what business need you have to fulfill”

after struggling to help in this thread for what was essentially the same problem:

http://www-10.lotus.com/ldd/nd6forum.nsf/ShowMyTopicsAllFlatweb/48b6e997a13bda048525738c00388799?OpenDocument

Subject: RE: HELP PLZ very important

I agree guys

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!

Mike

Subject: RE: HELP PLZ very important

Yes…

I believe that shatha could use some understanding of what it means to be CRISP (the letter “Y” left off purposely to void search hits):

http://www-10.lotus.com/ldd/nd6forum.nsf/c21908baf7e06eb085256a39006eae9f/410171d83ddba6d485256df100832aba?OpenDocument

Especially with regards to checklist items:

  1. Talk briefly about why you want to do this. There may be a better way to do it than what you are trying.

and

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

Subject: RE: HELP PLZ very important

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

Subject: RE: HELP PLZ very important

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

Mike

Subject: RE: HELP PLZ very important

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)