change input data

new BookmarkLockedFalling
kokenge
Senior Member
****

kokenge Avatar

Posts: 261

Post by kokenge on Jan 30, 2009 6:43:22 GMT -5

How can you stop input data from changing back to the original value?

In this example I have 2 input values.
One is a HTML <INPUT and one is a RB textbox.

When you change the values and click [Go] the HTMP <INPUT goes back to the original value.
How do you stop it from going back to the original value.??


[loop]
cls
html "<HR>"
a$ = "abcd"
html "<input id='#a' size=4 value='";a$;"' autocomplete=off />"
textbox #a,a,4ドル
html "<HR>"
button #go, "Go", [go]
wait
[go]
wait


Thanks for the help..
JackWebb
Junior Member
**

JackWebb Avatar

Posts: 69

Post by JackWebb on Jan 30, 2009 18:50:34 GMT -5

Hi K,

Not sure if this is the answer you're looking for but I suspect you're trying to do something more complex.


a$ = "abcd"
[loop]
cls
html "<HR>"
'a$ = "abcd"
html "<input id='#a' size=4 value='";a$;"' autocomplete=off />"
textbox #a,a,4ドル
html "<HR>"
button #go, "Go", [go]
wait
[go]
'wait
a$=#a contents$()
goto [loop]


Hope that helps
J.W.
Last Edit: Jan 30, 2009 18:51:00 GMT -5 by JackWebb
Live to code, code to live!
Carl Gundel - admin
Administrator
*****

Carl Gundel - admin Avatar

Posts: 550

Post by Carl Gundel - admin on Jan 31, 2009 0:23:14 GMT -5

The input field you insert with your code is not managed by Run BASIC. When you click on the Go button the page gets rendered again, and so does your original HTML code including the abcd.

What you need to do is get the contents out of the input field in your [go] routine. Use the #request object to get the value. To do this you must add a name property to the input element. Here is an example:

getInput$ = "abcd"
getTextbox$ = "abcd"
gosub [display]
wait

[go]
getInput$ = #request get$("input")
getTextbox$ = #a contents$()
gosub [display]
print "The input field holds: "; getInput$
print "The textbox holds: "; getTextbox$
wait

[display]
cls
html "<input id='#a' name='input' size=4 value='";getInput$;"' autocomplete=off />"
textbox #a,getTextbox,4ドル
button #go, "Go", [go]
print
return

Here is a version with only the input element.
getInput$ = "abcd"
gosub [display]
wait

[go]
getInput$ = #request get$("input")
gosub [display]
print "The input field holds: "; getInput$
wait

[display]
cls
html "<input id='#a' name='input' size=4 value='";getInput$;"' autocomplete=off />"
button #go, "Go", [go]
print
return

-Carl
kokenge
Senior Member
****

kokenge Avatar

Posts: 261

Post by kokenge on Jan 31, 2009 4:45:35 GMT -5

Thanks Carl.
I was hoping that I wouldn't have to make the round trip.

I was going to change all my stuff to HTML <INPUT because I needed some extra features. But if it is going to cost a round trip, I'll have to look into using CSS and textboxes.


Thanks for the help..
Last Edit: Jan 31, 2009 6:04:21 GMT -5 by kokenge
kokenge
Senior Member
****

kokenge Avatar

Posts: 261

Post by kokenge on Jan 31, 2009 7:17:12 GMT -5

Ok! I give up..

The <input tag accepts the autocomplete=off.
Why doesn't this set autocomplete off for the textbox,


call SetCSS
html "<input id='#a' size=4 autocomplete=off />"
textbox #a,"",4
#a setid("ao") 'set autocomplete=off
wait

SUB SetCSS
cssid #ao, "{AUTOCOMPLETE:off}"
END SUB
StefanPendl
Global Moderator
*****

StefanPendl Avatar

Run for BASIC ...
Posts: 945

Post by StefanPendl on Jan 31, 2009 9:24:58 GMT -5

Auto-complete is not a style, but an attribute.
You can not set attributes through CSS and JS only supports changing some of the attributes.

The autocomplete attribute seems to be IE only and other browsers need the tags in the head to make things work.

Best viewed with Any-Browser would be nice, bad boys at M$ ...
[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
kokenge
Senior Member
****

kokenge Avatar

Posts: 261

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
StefanPendl
Global Moderator
*****

StefanPendl Avatar

Run for BASIC ...
Posts: 945

Post by StefanPendl on Feb 1, 2009 4:31:37 GMT -5

I tried to use this, but then encountered another problem, where the contents of the RB text box could not be retrieved.

head "<meta http-equiv='cache-control' content='no-cache,no-store,must-revalidate,max-age=0'>
<meta http-equiv='pragma' content='no-cache'>"

[restart]
cls
print
print "RB Text Box"
textbox #box, ""
print
print

'HTML 5 Info at www.w3schools.com/tags/html5_input.asp
'HTML replacement for text box without auto complete
print "HTML Text Box"
html "<input type='text' id='#boxHTML' name='#boxHTML' value='"; text$; _
"' autocomplete='off' autofocus='true' />"
print
print
link #action, "Accept", [accept]
print
wait

[accept]
print
#box contents$(text$)
print text$
print
print #request get$("#boxHTML")
print
link #reload, "Reload", [restart]
print
wait

Last Edit: Feb 1, 2009 4:33:42 GMT -5 by StefanPendl
[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
kokenge
Senior Member
****

kokenge Avatar

Posts: 261