enforcing minimum length on text params

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

enforcing minimum length on text params

Sanka, Ravi
Greetings,

I am adding a new tool to our in-house Galaxy, which has a few string inputs. I have made each one a text param in the XML, but want to ensure that the user does not leave any empty when he executes the tool.

How can I do this? I tried setting the optional field of each text param to false, but that doesn't work since, technically, an empty string still counts as a string.

Is there a minimum length setting I can enforce?

----------------------------------------------
Ravi Sanka
ICS – Sr. Bioinformatics Engineer
J. Craig Venter Institute
301-795-7743
----------------------------------------------

___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: enforcing minimum length on text params

Nicola Soranzo
Il 2014-04-09 17:00 Sanka, Ravi ha scritto:

> Greetings,
>
> I am adding a new tool to our in-house Galaxy, which has a few string
> inputs. I have made each one a text param in the XML, but want to
> ensure that the user does not leave any empty when he executes the
> tool.
>
> How can I do this? I tried setting the optional field of each text
> param to false, but that doesn't work since, technically, an empty
> string still counts as a string.
>
> Is there a minimum length setting I can enforce?

Hi Ravi,
you should use a validator, as in the following example:

<param name="rgid" type="text" label="Read group identifier (ID)">
     <validator type="empty_field" />
</param>

Best,
Nicola
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: enforcing minimum length on text params

Sanka, Ravi
Hi Nicola,

Thank you. I tried the validator as you illustrated, and it worked
perfectly.

----------------------------------------------
Ravi Sanka
ICS ­ Sr. Bioinformatics Engineer
J. Craig Venter Institute
301-795-7743
----------------------------------------------




On 4/9/14 11:06 AM, "Nicola Soranzo" <[hidden email]> wrote:

>Il 2014-04-09 17:00 Sanka, Ravi ha scritto:
>> Greetings,
>>
>> I am adding a new tool to our in-house Galaxy, which has a few string
>> inputs. I have made each one a text param in the XML, but want to
>> ensure that the user does not leave any empty when he executes the
>> tool.
>>
>> How can I do this? I tried setting the optional field of each text
>> param to false, but that doesn't work since, technically, an empty
>> string still counts as a string.
>>
>> Is there a minimum length setting I can enforce?
>
>Hi Ravi,
>you should use a validator, as in the following example:
>
><param name="rgid" type="text" label="Read group identifier (ID)">
>     <validator type="empty_field" />
></param>
>
>Best,
>Nicola


___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: enforcing minimum length on text params

Sanka, Ravi
Hi Nicola,

Perchance, do you know what type of validator I can put to ensure that the
string input is does not consist of only whitespace? Such a string is
still invalid for my tool, but counts as a string.

----------------------------------------------
Ravi Sanka
ICS ­ Sr. Bioinformatics Engineer
J. Craig Venter Institute
301-795-7743
----------------------------------------------




On 4/9/14 2:35 PM, "Sanka, Ravi" <[hidden email]> wrote:

>Hi Nicola,
>
>Thank you. I tried the validator as you illustrated, and it worked
>perfectly.
>
>----------------------------------------------
>Ravi Sanka
>ICS ­ Sr. Bioinformatics Engineer
>J. Craig Venter Institute
>301-795-7743
>----------------------------------------------
>
>
>
>
>On 4/9/14 11:06 AM, "Nicola Soranzo" <[hidden email]> wrote:
>
>>Il 2014-04-09 17:00 Sanka, Ravi ha scritto:
>>> Greetings,
>>>
>>> I am adding a new tool to our in-house Galaxy, which has a few string
>>> inputs. I have made each one a text param in the XML, but want to
>>> ensure that the user does not leave any empty when he executes the
>>> tool.
>>>
>>> How can I do this? I tried setting the optional field of each text
>>> param to false, but that doesn't work since, technically, an empty
>>> string still counts as a string.
>>>
>>> Is there a minimum length setting I can enforce?
>>
>>Hi Ravi,
>>you should use a validator, as in the following example:
>>
>><param name="rgid" type="text" label="Read group identifier (ID)">
>>     <validator type="empty_field" />
>></param>
>>
>>Best,
>>Nicola
>


___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: enforcing minimum length on text params

Nicola Soranzo
Hi Ravi,
for that you need a regex validator:

https://bitbucket.org/galaxy/galaxy-central/src/tip/lib/galaxy/tools/parameters/validation.py#cl-27

e.g.

<validator type="regex" message="This field should contain some
non-whitespace character">.*\S</validator>

Best,
Nicola

Il giorno gio, 10/04/2014 alle 10.20 -0400, Sanka, Ravi ha scritto:

> Hi Nicola,
>
> Perchance, do you know what type of validator I can put to ensure that the
> string input is does not consist of only whitespace? Such a string is
> still invalid for my tool, but counts as a string.
>
> ----------------------------------------------
> Ravi Sanka
> ICS ­ Sr. Bioinformatics Engineer
> J. Craig Venter Institute
> 301-795-7743
> ----------------------------------------------
>
>
>
>
> On 4/9/14 2:35 PM, "Sanka, Ravi" <[hidden email]> wrote:
>
> >Hi Nicola,
> >
> >Thank you. I tried the validator as you illustrated, and it worked
> >perfectly.
> >
> >----------------------------------------------
> >Ravi Sanka
> >ICS ­ Sr. Bioinformatics Engineer
> >J. Craig Venter Institute
> >301-795-7743
> >----------------------------------------------
> >
> >
> >
> >
> >On 4/9/14 11:06 AM, "Nicola Soranzo" <[hidden email]> wrote:
> >
> >>Il 2014-04-09 17:00 Sanka, Ravi ha scritto:
> >>> Greetings,
> >>>
> >>> I am adding a new tool to our in-house Galaxy, which has a few string
> >>> inputs. I have made each one a text param in the XML, but want to
> >>> ensure that the user does not leave any empty when he executes the
> >>> tool.
> >>>
> >>> How can I do this? I tried setting the optional field of each text
> >>> param to false, but that doesn't work since, technically, an empty
> >>> string still counts as a string.
> >>>
> >>> Is there a minimum length setting I can enforce?
> >>
> >>Hi Ravi,
> >>you should use a validator, as in the following example:
> >>
> >><param name="rgid" type="text" label="Read group identifier (ID)">
> >>     <validator type="empty_field" />
> >></param>
> >>
> >>Best,
> >>Nicola
> >
>


___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/