Checkbox without submit

new BookmarkLockedFalling
marcioc
Junior Member
**

marcioc Avatar

Posts: 60

Post by marcioc on Aug 31, 2010 20:18:47 GMT -5

I need help from the javascript experts. I am very close to develop a checkbox without submit. It is missing a final detail.

I cannot get the value of the box checked after it has been submited.

 cls link #q,".",[test]
html "<script type=""text/javascript"">
var a=null;
function inform(form,ref,v) {
var timer;
var as = document.getElementsByTagName('A');
for (var i = 0; i < as.length; i++) {
if (as.firstChild.data == ref)
{
a = as;
break;
}
}
if (a) {
form.inputbox.value=v;
location= a.href;
document.myform.submit();
}
}
</script> "

html "<form name='myform'>"
html "<input type='checkbox' name='inputbox' value='Bike' id='vehicle' onclick='inform(this.form,""."",""Bike"")' /> I have a bike<br />
<input type='checkbox' name='inputbox' value='Car' id='vehicle' onclick='inform(this.form,""."",""Car"")' /> I have a car"
html "</form>"
wait

[test]
cls
inf$= #request get$("vehicle")
print "You clicked ";inf$


Last Edit: Sept 1, 2010 3:34:21 GMT -5 by StefanPendl
StefanPendl
Global Moderator
*****

StefanPendl Avatar

Run for BASIC ...
Posts: 945

[b]Stefan[/b] - [a href=http://stefanpendl.runbasichosting.com/]Homepage[/a][br][br][b]Please give credit if you use code I post, no need to ask for permission.[/b][br][br]Run BASIC 1.01, Fire-/Waterfox (IE11, Edge), Windows 10 Professional x64, Intel Core i7-4710MQ 2.5GHz, 16GB RAM
marcioc
Junior Member
**

marcioc Avatar

Posts: 60

Post by marcioc on Sept 1, 2010 8:32:32 GMT -5

In screens that you have to filter information according to previous fields, You have to do this dynamically. For example, many times when you shop through the WEB, and you have to specify in details the product you are shopping, if you do not have the check box generating an event, you have to submit the screen for each option you select in order to be able to update the next options on the screen.

In a strong tool as Run Basic, you have to be more flexible, otherwise it looks like the old IBM mainframe 3272 terminal without the possibility to validate information before you complete the entire screen.

I also do not like WEB Pages that after you introduce zillions of information and submit it, you get a message that field 1 has an error. It could be detected in advance. Many WEB pages has this good functionality.

I am developing this functionality for check box, however my intention is to have on click for any type of field as you have in html.

Thank you for your good question.
marcioc
Junior Member
**

marcioc Avatar

Posts: 60

kokenge
Senior Member
****

kokenge Avatar

Posts: 261

Post by kokenge on Sept 1, 2010 11:43:53 GMT -5

There is post on a event handler.
It handles all triggered events such as on-click, mouse-over, on-change or whatever.

Unfortunately it takes two projects, but well worth it.

I use it all the time to eliminate batch screens that you talk about, and make then interactive.

runbasic.proboards.com/index.cgi?action=display&board=general&thread=1099&page=1

HTH..
Dan
marcioc
Junior Member
**

marcioc Avatar

Posts: 60

Post by marcioc on Sept 1, 2010 12:10:55 GMT -5

Uau, sounds like everybody wants events. As you can see in the code I posted, I am very close to get there in a very simple solution. It will allow to use all events supported in HTML just adding a simple java scrip function.

The code already go to any reference in the program when clicked, I am having problem getting the associated information using RB #request get$.

I will continue working in this solution and I will keep you guys informed.

Help from the Javascrip experts will be very welcome.
kokenge
Senior Member
****

kokenge Avatar

Posts: 261

Post by kokenge on Sept 1, 2010 17:56:02 GMT -5

Just a guess, but I think the reason you don't see the check mark is because the form runs your Run Basic Code again and the first thing it does is clear the screen.

Maybe something like this will work..

if firstTime = 0 then
firstTime = 1
cls
link #q,".",[test]
.
.
.
.
.
wait
end if

[test]
inf$= #request get$("vehicle")
print "You clicked ";inf$
wait


HTH
Dan
marcioc
Junior Member
**

marcioc Avatar

Posts: 60

Post by marcioc on Sept 1, 2010 20:33:07 GMT -5

Good try; unfortunately it did not work.

I believe that the command location = a.ref, clears the values of the variables in the current form. One of the options could be saving the java script variable v in a RB variable before the location = a.ref command, eliminating the command inf$= #request get$("vehicle") in RB code.

I saw some examples in Ajax how to save a java script variable in a PHP variable.

Maybe Carl, who knows the RB guts could give us a tip in how to do this in a RB variable.

Thanks
StefanPendl
Global Moderator
*****

StefanPendl Avatar

Run for BASIC ...
Posts: 945

[b]Stefan[/b] - [a href=http://stefanpendl.runbasichosting.com/]Homepage[/a][br][br][b]Please give credit if you use code I post, no need to ask for permission.[/b][br][br]Run BASIC 1.01, Fire-/Waterfox (IE11, Edge), Windows 10 Professional x64, Intel Core i7-4710MQ 2.5GHz, 16GB RAM
marcioc
Junior Member
**

marcioc Avatar

Posts: 60

StefanPendl
Global Moderator
*****

StefanPendl Avatar

Run for BASIC ...
Posts: 945

[b]Stefan[/b] - [a href=http://stefanpendl.runbasichosting.com/]Homepage[/a][br][br][b]Please give credit if you use code I post, no need to ask for permission.[/b][br][br]Run BASIC 1.01, Fire-/Waterfox (IE11, Edge), Windows 10 Professional x64, Intel Core i7-4710MQ 2.5GHz, 16GB RAM
marcioc
Junior Member
**

marcioc Avatar

Posts: 60