I have achieved this by use of JavaScript as follows:

....
....

//2009-06-05T00:00:00
    var validDate =
/^([\d]{4})-([\d]{2})-([\d]{2})T([\d]{2})\:([\d]{2})\:([\d]{2})$/i;
    var elements = document.getElementsByName('dateOfBirth');
    for(var i = 0; i < elements.length; i++){
        //alert('element:'+i +' element.value:'+ elements[i].value);
        if(!(validDate.test(elements[i].value))){
//here i am showing a error message, you can alert also.

document.getElementById('registration_error_date_of_birth_required').style.display
= "";
            isError = 1;
        }
        if(isError){
            break;
        }
    }
...
...


This function is called on submit of the form.

But i would like to know if there is a way in Struts to control the user
entry in the textbox.

Regards,
---------------------------------------------------------
Girish Naik
Mobile:-+91-09740091638
girish.n...@gmail.com
W. C. Fields <http://www.brainyquote.com/quotes/authors/w/w_c_fields.html>
- "I am free of all prejudices. I hate every one equally."

On Sat, May 30, 2009 at 11:28 AM, Girish Naik <girish.n...@gmail.com> wrote:

> There is no readonly attribute in s:datetimepicker tag. I am using the
> following tag
>
> <s:datetimepicker     id="registration_date_of_birth_field"
>                             name="dateOfBirth"
>                             labelposition="left"
>                             type="date" toggleDuration="2000"
> toggleType="fade" disabled="true"
>                             required="true"
>                             displayFormat="yyyy-MM-dd'T'HH:mm:ss"
>                             weekStartsOn="1"  />
>
>
> PFA for the rendered UI for the above tag.
>
>
> Regards,
> ---------------------------------------------------------
> Girish Naik
> Mobile:-+91-09740091638
> girish.n...@gmail.com
> Frank Lloyd 
> Wright<http://www.brainyquote.com/quotes/authors/f/frank_lloyd_wright.html> - 
> "TV is chewing gum for the eyes."
>
> On Fri, May 29, 2009 at 11:37 PM, Jim Collings <jlistn...@gmail.com>wrote:
>
>> I just did this a while ago. All I had to do was set:
>>
>> readonly="true"
>>
>> on the struts textfield tag. Mine doesn't have an icon though.
>>
>> On Fri, May 29, 2009 at 2:00 PM, Girish Naik <girish.n...@gmail.com>
>> wrote:
>> > Hi,
>> > I have used struts2-core-2.0.11.2 in My Application. And intend to use
>> the
>> > Struts date time picker, but the text field is coming as an editable
>> field.
>> > I want to make it as a readonly textbox. The funny thing  is that the
>> dojo
>> > is not ready to pass my id to the textbox. Only name is supplied to the
>> text
>> > box.
>> >
>> > Any suggesstions on how to make the textbox non editable and only the
>> icon
>> > clickable?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>

Reply via email to