PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WEBDEV 2024 → Browser YesNo
Browser YesNo
Iniciado por Zach Allen, 14,abr. 2014 20:45 - 5 respuestas
Publicado el 14,abril 2014 - 20:45
Hi all,
I'm trying to get YesNo to work in browser code so that I can run my server code in AJAX.
I don't want to use Cells or Popups because I have multiple buttons that I need to ask Yes No with different text and different server code. ie (Save), (Save and Close) and (Save and Next)

These are some of my attempts so far:
Some of them may not make sense but I'm just trying to get it to popup right now.
My goal is to have the YesNo on the browser code of a button.
When Yes is pressed, the server code of the button will run.
When No is pressed, the button will not run the server code and return.

YesNo(0,"",ReturnToCapture(),"Are You Sure?")

YesNo(0,"","","Are You Sure?")

YesNo(0,RETURN,RETURN,"Are You Sure?")

YesNo(0,"","RETURN","Are You Sure?")


I've put a trace around each attempt ie:
Trace("Start")
YesNo(0,"",ReturnToCapture(),"Are You Sure?")
Trace("End")


Every single attempt has printed out the first trace("Start") and that is it.
No second trace and no popup.

I've also tried all of these options with the first optional parameter(0) omitted as well.
The example in WebDev for YesNo in WWDialog is only for the server code version.
Has anyone been able to get YesNo to work in the Browser?
Publicado el 15,abril 2014 - 13:38
Hi Zach

you should read closely the help pertaining to YES in BROWSER code... it
says that for yes and no, the string can be:

•the name of a button. If the Yes button is selected, the click code of
this button will be run.
•the name of a browser function or procedure. If the Yes button is
selected, this procedure will be run.
•a string or another value. If the Yes button is selected, the value
will be run as being a JavaScript code.

However, you are trying a lot of things, but NONE of them has any
relationship with the syntax for browser code...

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

NEW: WXShowroom.com is available: Show your projects!
More information on http://www.fabriceharari.com


On 4/14/2014 12:45 PM, Zach Allen wrote:
Hi all,
I'm trying to get YesNo to work in browser code so that I can run my
server code in AJAX.
I don't want to use Cells or Popups because I have multiple buttons that
I need to ask Yes No with different text and different server code. ie
(Save), (Save and Close) and (Save and Next)

These are some of my attempts so far:
Some of them may not make sense but I'm just trying to get it to popup
right now.
My goal is to have the YesNo on the browser code of a button.
When Yes is pressed, the server code of the button will run.
When No is pressed, the button will not run the server code and return.

YesNo(0,"",ReturnToCapture(),"Are You Sure?")
YesNo(0,"","","Are You Sure?")
YesNo(0,RETURN,RETURN,"Are You Sure?")

YesNo(0,"","RETURN","Are You Sure?")


I've put a trace around each attempt ie:
Trace("Start")
YesNo(0,"",ReturnToCapture(),"Are You Sure?") Trace("End")


Every single attempt has printed out the first trace("Start") and that
is it.
No second trace and no popup.

I've also tried all of these options with the first optional
parameter(0) omitted as well.
The example in WebDev for YesNo in WWDialog is only for the server code
version.
Has anyone been able to get YesNo to work in the Browser?
Publicado el 16,abril 2014 - 14:19
Thanks for the reply Fabrice,
The last option for both Yes and No arguments in the documentation is
"a string or another value. If the Yes button is selected, the value
will be run as being a JavaScript code."

My thinking was an empty string would have the YesNo do nothing. As in if yes then continue with button code.
Also return is a valid Javascript command to my knowledge so both should work.

My original though was this but it didn't work
YesNo("","return;","Are you sure?")

This would do nothing if the Yes is pressed, and return if the No was pressed.
Any idea why this would not work?

I also tried
YesNo(BTN_Myself,PageRefresh(),"Are you sure?")
which uses the other two options for arguments(Button name and Function).
This did not work either.
Publicado el 16,abril 2014 - 15:54
Hi Zach

AFAIK, and I'm not a JS specialist, JS code is always between { }...
Now, in that particular syntax, I don't know.

As for the empty string, there is nothing in the help that says that
this would be supported.. If it is waiting for JS code and find an empty
string, my understanding of the way JS works is that this will create an
error preventing anything to work

Best regards


--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

NEW: WXShowroom.com is available: Show your projects!
More information on http://www.fabriceharari.com


On 4/16/2014 6:19 AM, Zach Allen wrote:
Thanks for the reply Fabrice,
The last option for both Yes and No arguments in the documentation is
"a string or another value. If the Yes button is selected, the value
will be run as being a JavaScript code."

My thinking was an empty string would have the YesNo do nothing. As in
if yes then continue with button code.
Also return is a valid Javascript command to my knowledge so both should
work.

My original though was this but it didn't work
YesNo("","return;","Are you sure?")

This would do nothing if the Yes is pressed, and return if the No was
pressed.
Any idea why this would not work?

I also tried
YesNo(BTN_Myself,PageRefresh(),"Are you sure?")
which uses the other two options for arguments(Button name and Function).
This did not work either.
Publicado el 24,abril 2014 - 20:14
Thank you for the suggestion,
As for JS itself outside of WebDev, you do not need { } around JS code unless it's in a function.
if using JS within a html document than you need to have <script> tags around the JS code.

I have tried the following and still have not been able to get any window to appear:

YesNo("{}", "{}","Are you sure?");
YesNo("{ int x = 5 }", "{ int x = 5 }","Are you sure?");
YesNo("{ int x = 5; }", "{ int x = 5; }","Are you sure?");
YesNo("{ return }", "{ return }","Are you sure?");
YesNo("{ return; }", "{ return; }","Are you sure?");
YesNo(0,"{}", "{}","Are you sure?");
YesNo(0,"{ int x = 5 }", "{ int x = 5 }","Are you sure?");
YesNo(0,"{ int x = 5; }", "{ int x = 5; }","Are you sure?");
YesNo(0,"{ return }", "{ return }","Are you sure?");
YesNo(0,"{ return; }", "{ return; }","Are you sure?");
YesNo(1,"{}", "{}","Are you sure?");
YesNo(1,"{ int x = 5 }", "{ int x = 5 }","Are you sure?");
YesNo(1,"{ int x = 5; }", "{ int x = 5; }","Are you sure?");
YesNo(1,"{ return }", "{ return }","Are you sure?");
YesNo(1,"{ return; }", "{ return; }","Are you sure?");


If yourself or anyone else have any suggestions on how to get this function to work in browser code it would be appreciated. Doesn't matter the syntax I'm just trying to get it to show up first and then I'll go from there.
Publicado el 25,abril 2014 - 11:50
Hi Zach

as I was suggesting before, did you try the MAIN syntax (ie using two
buttons)?

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

NEW: WXShowroom.com is available: Show your projects!
More information on http://www.fabriceharari.com


On 4/24/2014 12:14 PM, Zach Allen wrote:
Thank you for the suggestion,
As for JS itself outside of WebDev, you do not need { } around JS code
unless it's in a function.
if using JS within a html document than you need to have <script> tags
around the JS code.

I have tried the following and still have not been able to get any
window to appear:

YesNo("{}", "{}","Are you sure?");
YesNo("{ int x = 5 }", "{ int x = 5 }","Are you sure?");
YesNo("{ int x = 5; }", "{ int x = 5; }","Are you sure?");
YesNo("{ return }", "{ return }","Are you sure?");
YesNo("{ return; }", "{ return; }","Are you sure?");
YesNo(0,"{}", "{}","Are you sure?");
YesNo(0,"{ int x = 5 }", "{ int x = 5 }","Are you sure?");
YesNo(0,"{ int x = 5; }", "{ int x = 5; }","Are you sure?");
YesNo(0,"{ return }", "{ return }","Are you sure?");
YesNo(0,"{ return; }", "{ return; }","Are you sure?");
YesNo(1,"{}", "{}","Are you sure?");
YesNo(1,"{ int x = 5 }", "{ int x = 5 }","Are you sure?");
YesNo(1,"{ int x = 5; }", "{ int x = 5; }","Are you sure?");
YesNo(1,"{ return }", "{ return }","Are you sure?");
YesNo(1,"{ return; }", "{ return; }","Are you sure?");


If yourself or anyone else have any suggestions on how to get this
function to work in browser code it would be appreciated. Doesn't matter
the syntax I'm just trying to get it to show up first and then I'll go
from there.