How to customize component fr:number

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to customize component fr:number

ricetrac

Hi,

 

I would to use the xbl component fr:number, but how to customize the size and maxlength  properties like an input ?

 

Thank You.

 

Julien

 

 

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: How to customize component fr:number

Alessandro  Vernet
Administrator
Hi Julien,

In Form Builder, you can set the maxlength through the Control Settings for the number fields, just like you would for any other control: http://i.imgur.com/rWzb7Tk.png. In the XForms code, this generates a constraint="xxf:max-length(2)" on the corresponding xf:bind, and this is how we'd recommend you set the maxlength on a field.

The xxf:maxlength is supported on the xf:input and just produces an attribute with the same name on the corresponding HTML input. In addition to not being supported on other controls, it has at least 2 other problems:

- Usability: when the user writes a string that is too long, she's forced to go back in the text to remove some characters, then forward again to the end to add some, and so on.
- Data consistency: since the constraint is only enforced on the browser, a malicious user can update the value of maxlength in the DOM, and enter a longer value.

For those reasons, we recommend to use a constraint, and this is what Form Builder does by default.

I hope this helps,

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to customize component fr:number

ricetrac
Hi Alex,

I understand, but how to emulate the property "size"  ? in CSS, with "width" property ?

It's not very convenient, because in a table, for example , the column is not resized automatically.

Thank You.

Julien

-----Message d'origine-----
De : [hidden email] [mailto:[hidden email]] De la part de Alessandro Vernet
Envoyé : vendredi 23 octobre 2015 02:09
À : [hidden email]
Objet : [orbeon] Re: How to customize component fr:number

This mail was sent to an address in the @unilog.logicacmg.com domain. This mail domain will be retired soon, if you wish to continue receiving mail from this sender please inform them to use an @cgi.com address instead.

This mail was sent to an address in the @logicacmg.com domain. This mail domain will be retired soon, if you wish to continue receiving mail from this sender please inform them to use an @cgi.com address instead.

Hi Julien,

In Form Builder, you can set the maxlength through the Control Settings for the number fields, just like you would for any other control:
http://i.imgur.com/rWzb7Tk.png. In the XForms code, this generates a constraint="xxf:max-length(2)" on the corresponding xf:bind, and this is how we'd recommend you set the maxlength on a field.

The xxf:maxlength is supported on the xf:input and just produces an attribute with the same name on the corresponding HTML input. In addition to not being supported on other controls, it has at least 2 other problems:

- Usability: when the user writes a string that is too long, she's forced to go back in the text to remove some characters, then forward again to the end to add some, and so on.
- Data consistency: since the constraint is only enforced on the browser, a malicious user can update the value of maxlength in the DOM, and enter a longer value.

For those reasons, we recommend to use a constraint, and this is what Form Builder does by default.

I hope this helps,

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
View this message in context: http://discuss.orbeon.com/How-to-customize-component-fr-number-tp4660716p4660722.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: How to customize component fr:number

Alessandro  Vernet
Administrator
Julien,

Are you saying that if you're using width: 3em in CSS the table doesn't get resized while it does if you use the size="3" attribute?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to customize component fr:number

ricetrac
Hi,

Yes , it's that.
We add <fr:number> on a <td>, we apply width property on the input generate by fr:number, and the result is bad : the input is smaller but the column have always the same size.

Julien


-----Message d'origine-----
De : [hidden email] [mailto:[hidden email]] De la part de Alessandro Vernet
Envoyé : samedi 24 octobre 2015 01:12
À : [hidden email]
Objet : [orbeon] Re: How to customize component fr:number

Julien,

Are you saying that if you're using width: 3em in CSS the table doesn't get resized while it does if you use the size="3" attribute?

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
View this message in context: http://discuss.orbeon.com/How-to-customize-component-fr-number-tp4660716p4660728.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: How to customize component fr:number

Alessandro  Vernet
Administrator
Julien, so you're saying that setting the width of the field with CSS doesn't change the width of the column. But does changing the width of an input with the `width` attribute change the width of the column? I would expect both methods to have the same effect as far as the width of the column is concerned.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet