PDA

View Full Version : How to declace a hidden field in a form


nmquang
09-12-2004, 07:57 PM
Hi All,

I want to post a form which have some hidden fields. But i don't know how to declare a hidden field. I used edittext tag with attribute visible='false' and/or enable='false', but it didn't work.

Please help me!

Thank a lots!

Minh Quang

antun
09-13-2004, 09:18 AM
You can use an instance of baseformitem, and give it a unique name and a value:

http://www.laszlosystems.com/lps-2.1.2/docs/lzx-reference/?baseformitem.html

It'll behave just like a hidden form field.

-Antun

nmquang
09-13-2004, 07:04 PM
It works! Thank you! :-)

Minh Quang

dybomaha
09-17-2004, 08:34 AM
I am still getting used to Laszlo development, but why woudl you need a hidden field?

In HTML, a hidden field is used to overcome the stateless model, and hold a variable.

Since Laszlo development uses a dependable Javascript engine, why wouldn't you store hidden varibles in a Javascript variable?


<script>
var hidden = null;
</script>


I look forward to your thoughts,
DYBOMAHA

nmquang
09-17-2004, 06:03 PM
Hi DYBOMAHA,

I' sorry, but I don't understand all you mean. It may be i'm a beginer to JavaScript.

But I need a hidden field because when user post a form data, The server page (JSP or ASP) need more data which I don't want (and no need) show to user.

EX:
The server page sent to client a list of record,
When user update data for a record, the server page need knowing record's ID, but the ID field is no need (and should not) show to user as form data. How can I resolve that issue by JavaScript?

regards,

Minh Quang

awhite
12-30-2005, 08:45 PM
Just in case anyone else reads this...

baseformitem does work as a hidden field however since "value" is of type "expression", I found that I had to do value="${'A'}" to get it to submit string values.

based on the source code, it looks like I could use text (that's why edittext works i believe), but when I said text="A", the getValue() method which the submit component uses returned null.

feng01301218
01-02-2006, 08:46 PM
you can use edittext in the form ,and set the visible of edittext is false,
for example;
<form >
<submit id="user_survey"/>
<edittext id="hidden" visible="false" text="...."/>
some code.....
</form>

note:before you submit the form,please don't forget set the value for edittext.

such as:
hidden.setText("orderId");
user_survey.submit();

it's work well.

maritimesource
06-07-2006, 06:23 AM
Hi,

I'm attempting to add some value to this post. You can also do this:

<dataset name="dLogin" src="http:server/action.php?action=login" type="http" request="false"/>

When action.php receives the request, you'll end up with $_GET['action'] with a value of "login".

Good luck

Shelby
06-08-2006, 06:13 AM
Some time ago, I created a really simple class to handle this. I've had no problem using the setText() method and having it send the value of the text attribute. You could have it set the "value" attribute in the text setter as well.


<library>

<class extends="baseformitem" focusable="false" name="invisibleFormItem" visible="false">
<attribute name="text" setter="setText(text)"></attribute>
<event name="ontext"></event>

<method args="val" name="setText"><![CDATA[
this.text = val;
if (this.ontext != null) this.ontext.sendEvent(val);
]]>
</method>
</class>

</library>