You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by bs <bs...@gmail.com> on 2006/09/21 23:44:07 UTC

make javascript to display just an variable as an alert

Hi,

<h:form id="input-form">
...
<t:inputText forceId = "true" id = "search_txt" value = "#{bean.method1}"
forceId="true"/>

<t:selectOneMenu id="query_menu" value = "#{bean.metnod2}" onclick
="alert('hi how are you')">
....
</h:form>

<t:selectOneMenu id="query_menu" value = "#{bean.metnod2}" onclick ="alert(
document.forms['input-form'].elements['search_text].value)">

in the onclick method i display an alert, it works fine if i choose a
string("hi how are you") but if i try to dynamically display a value from
the text it gives me a errot telling that " properties not found".

this error is bugging me for quiet some time, am i writing the syntax for
javascript correct?

Thank you for reading my message

Re: make javascript to display just an variable as an alert

Posted by bs <bs...@gmail.com>.
Hi Jason,

it was a typo, i had the tick in my code, the error i get is
document.forms['input-form'] has no properties

any further suggestions....



On 9/21/06, Jason King <jh...@airmail.net> wrote:
>
> Your js code isn't valid
> <t:selectOneMenu id="query_menu" value = "#{bean.metnod2}" onclick
> ="alert(document.forms['input-form'].elements['search_text'].value)">
>
> I added a tick to the end of elements['search_text before the ].value)"
> part.
>
> bs wrote:
> > Hi,
> >
> > <h:form id="input-form">
> > ...
> > <t:inputText forceId = "true" id = "search_txt" value =
> > "#{bean.method1}" forceId="true"/>
> >
> > <t:selectOneMenu id="query_menu" value = "#{ bean.metnod2}" onclick
> > ="alert('hi how are you')">
> > ....
> > </h:form>
> >
> > <t:selectOneMenu id="query_menu" value = "#{bean.metnod2}" onclick
> > ="alert(document.forms['input-form'].elements['search_text].value)">
> >
> > in the onclick method i display an alert, it works fine if i choose a
> > string("hi how are you") but if i try to dynamically display a value
> > from the text it gives me a errot telling that " properties not found".
> >
> > this error is bugging me for quiet some time, am i writing the syntax
> > for javascript correct?
> >
> > Thank you for reading my message
> >
> >
> >
>
>

Re: make javascript to display just an variable as an alert

Posted by Jason King <jh...@airmail.net>.
Your js code isn't valid
<t:selectOneMenu id="query_menu" value = "#{bean.metnod2}" onclick 
="alert(document.forms['input-form'].elements['search_text'].value)"> 

I added a tick to the end of elements['search_text before the ].value)" 
part.

bs wrote:
> Hi,
>
> <h:form id="input-form">
> ...
> <t:inputText forceId = "true" id = "search_txt" value = 
> "#{bean.method1}" forceId="true"/>
>
> <t:selectOneMenu id="query_menu" value = "#{ bean.metnod2}" onclick 
> ="alert('hi how are you')">
> ....
> </h:form>
>
> <t:selectOneMenu id="query_menu" value = "#{bean.metnod2}" onclick 
> ="alert(document.forms['input-form'].elements['search_text].value)">
>
> in the onclick method i display an alert, it works fine if i choose a 
> string("hi how are you") but if i try to dynamically display a value 
> from the text it gives me a errot telling that " properties not found".
>
> this error is bugging me for quiet some time, am i writing the syntax 
> for javascript correct?
>
> Thank you for reading my message
>
>
>


Re: make javascript to display just an variable as an alert

Posted by Gerald Müllan <bi...@gmail.com>.
If it still doesn`t work, place the generated markup here.

regards,

Gerald

On 9/22/06, Gerald Müllan <bi...@gmail.com> wrote:
> Hi,
>
> your statement should work perfectly, to be sure i have tested it out
> with venkman :)
>
> Only when inserting the ['search_text] clause there is the last '
> missing, but don`t know if its only a typo when copying it here.
>
> Otherwise, test out if the generated markup is correct (id etc.).
>
> cheers,
>
> Gerald
>
> On 9/21/06, bs <bs...@gmail.com> wrote:
> > Hi,
> >
> > <h:form id="input-form">
> > ...
> > <t:inputText forceId = "true" id = "search_txt" value = "#{bean.method1}"
> > forceId="true"/>
> >
> > <t:selectOneMenu id="query_menu" value = "#{ bean.metnod2}" onclick
> > ="alert('hi how are you')">
> > ....
> > </h:form>
> >
> > <t:selectOneMenu id="query_menu" value = "#{bean.metnod2}" onclick
> > ="alert(document.forms['input-form'].elements['search_text].value)">
> >
> > in the onclick method i display an alert, it works fine if i choose a
> > string("hi how are you") but if i try to dynamically display a value from
> > the text it gives me a errot telling that " properties not found".
> >
> > this error is bugging me for quiet some time, am i writing the syntax for
> > javascript correct?
> >
> > Thank you for reading my message
> >
> >
> >
> >
>
>
> --
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>


-- 
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: make javascript to display just an variable as an alert

Posted by Gerald Müllan <bi...@gmail.com>.
Hi,

your statement should work perfectly, to be sure i have tested it out
with venkman :)

Only when inserting the ['search_text] clause there is the last '
missing, but don`t know if its only a typo when copying it here.

Otherwise, test out if the generated markup is correct (id etc.).

cheers,

Gerald

On 9/21/06, bs <bs...@gmail.com> wrote:
> Hi,
>
> <h:form id="input-form">
> ...
> <t:inputText forceId = "true" id = "search_txt" value = "#{bean.method1}"
> forceId="true"/>
>
> <t:selectOneMenu id="query_menu" value = "#{ bean.metnod2}" onclick
> ="alert('hi how are you')">
> ....
> </h:form>
>
> <t:selectOneMenu id="query_menu" value = "#{bean.metnod2}" onclick
> ="alert(document.forms['input-form'].elements['search_text].value)">
>
> in the onclick method i display an alert, it works fine if i choose a
> string("hi how are you") but if i try to dynamically display a value from
> the text it gives me a errot telling that " properties not found".
>
> this error is bugging me for quiet some time, am i writing the syntax for
> javascript correct?
>
> Thank you for reading my message
>
>
>
>


-- 
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces