Skip to Content
author's profile photo Former Member
Former Member

hidden field in SAP UI 5

In plain html , there is hidden field

<input type ="hidden">

which will be rendered on the browser but not visible to the user .

In SAP UI 5 , what is the equivalent component for hidden field?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2013 at 04:30 AM

    You can use TextField and set visibility false.

    var oInput = new sap.ui.commons.TextField({
    id: 'input2',
    value : 'Hello World!',
    tooltip : 'Change the Text',
    width : '10em',
    visible:false
    });

    Regards

    Manoj

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      visible=false will lead to the <input> not being present in HTML at all.

      IF the target is really to have Form-based submission for some reason (instead of AJAX calls), then this would not help to submit hidden data.

      In this special case one could use a sap.ui.core.HTML control which renders the hidden input tag, or one could inherit from the UI5 input control and add the "hidden" in the renderer.

      For the <form> itself an HTML control (or plain HTML in an XML-/HTMLView) is also required.

      But as others have mentioned, usually AJAX calls are used to send data to the server and then you don't need <form> or hidden inputs.

      Regards

      Andreas

  • Posted on Sep 26, 2013 at 09:57 AM

    I guess I have to ask myself - for what purpose are you wanting a hidden input field? Others have shown you how to control the visibility of an element, but usually the point of a hidden input field is to store additional data to be sent on a request. If this is what you want to achieve you might want to look at the Element's data() function

    https://sapui5.hana.ondemand.com/sdk/#docs/api/symbols/sap.ui.core.Element.html#data

    which will allow you to attach custom data to any Element (and by inference any Control).

    dj

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 26, 2013 at 03:27 AM

    UI5 does not have the concept of FORM submission like in conventional HTML. And data submission happens with AJAX calls so it is event driven and data submission can be done with all the events. So to maintain hidden variables you can create local/global java script variables and pass the values in your AJAX calls to REST/WS services.

    Thanks

    Abhilash

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2013 at 04:47 AM

    Hi,

    Almost all the UI5 elements has the property of 'visibility' , using this property you can maintain the visibility of a particular UI element.

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.