Page 1 of 1

Text Input on Mobile

Posted: Tue May 05, 2026 12:53 am
by Paul
How would I do an equivalent to a EditorGadget using mobile mode since there is no EditorMobile ?

The HtmlMobile command looked promising to do something like

Code: Select all

HtmlMobile("<textarea id='txt1' name='txt1' rows='4' cols='50'></textarea>")
but then how to get the text from it like GetMobileText(#Mobile) command?

The commands available for Mobile seem very limited compared to the commands for Web :(

Re: Text Input on Mobile

Posted: Tue May 05, 2026 8:16 am
by Danilo
Paul wrote: Tue May 05, 2026 12:53 am

Code: Select all

HtmlMobile("<textarea id='txt1' name='txt1' rows='4' cols='50'></textarea>")
but then how to get the text from it like GetMobileText(#Mobile) command?
You can set and get the text using the .value property:

Code: Select all

Procedure SetTextAreaText(id.s, text.s)
	!var textarea = document.getElementById(v_id);
	!if(textarea) textarea.value = v_text;
EndProcedure

Procedure AppendTextAreaText(id.s, text.s)
	!var textarea = document.getElementById(v_id);
	!if(textarea) textarea.value += v_text;
EndProcedure

Procedure.s GetTextAreaText(id.s)
	!var textarea = document.getElementById(v_id);
	!if(textarea) return textarea.value.toString();
EndProcedure

If ContainerMobile(#PB_Any, #PB_Mobile_Page, "margin:8px")
	HtmlMobile("<textarea id='txt1' name='txt1' rows='4' cols='50'></textarea>")
	HtmlMobile("<br/>")
	HtmlMobile("<textarea id='txt2' name='name' rows='4' cols='50' wrap='off' style='resize:none; color:RGBA(0,200,200,1); background:RGBA(50,50,50,1);'></textarea>")
	
	SetTextAreaText("txt1", "TextArea 1 text.")
	AppendTextAreaText("txt1", ~"\nSome more text.")
	
	SetTextAreaText("txt2", "TextArea 2 text.")
	
	Debug GetTextAreaText("txt1")
	Debug "-----"
	Debug GetTextAreaText("txt2")
	Debug "-----"
	
	CloseMobileContainer()
EndIf

Re: Text Input on Mobile

Posted: Tue May 05, 2026 1:39 pm
by Paul
Thanks Danilo !!!
Exactly what I needed :)

Re: Text Input on Mobile

Posted: Tue May 12, 2026 8:29 am
by Fred
Don't hesitate to tell if you miss something in the Mobile UI lib, as I don't personally use it