Ananya Raju
Posts: 0
Joined: Tue Oct 01, 2013 8:04 am

Form

HEllo,
i am performing form validation on text area....i have used....
if (Appery('textareaname').val()=== " ")
{
statements
}
else
{
statements
}

and also i have used...

if (Appery("textareaname").attr("value") === " ")
{
statements
}
else
{
statements
}

both seems to console the contents of textareaname when i try to console it but seems not to perform any form validation pls help me ...

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Form

Hi Ananya,

Please remove space between quotes in a condition. Here is the correct expression:preAppery("mobiletextarea").val()/pre

Ananya Raju
Posts: 0
Joined: Tue Oct 01, 2013 8:04 am

Form

it doesnt work i have tried the following code
if(Appery("mobiletextarea").val()==="")

{
Appery("mobilebutton").addClass("ui-disabled");
alert("Alert ALERT ALERT ");
}
else
{
Appery("mobilebutton").removeClass("ui-disabled");
}

it doesnt work....i have added this on button click and the value change of the textarea to toggle the visibility of the button....

and i even tried with

Appery("textareaname").attr("value") === "") ths too doesnt work
pls help

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Form

Hello! Add your code on Keyup event of mobiletextarea component.

Ananya Raju
Posts: 0
Joined: Tue Oct 01, 2013 8:04 am

Form

thansk .... i also had a query if i have about like 3 input box and a button ...
on the click of that button i want the form to validate in such a way that the inputboxes dat do not contain text must be outlined with red and a toast message must pop up saying that these fields are not entered cud u pls help me out with the code ...as i said i need a toast message not an alert....
cud u also pls tell me wat are the other ways of notifying the user other than alert,toast
is toast feature included in it?
if toast isnt then u can display an pop up itself while mentioning the code

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Form

You can use toast like messages https://gist.github.com/kamranzafar/3.... Create JS asset with the following codeprevar toast = function(msg){
$("<div class='ui-loader ui-overlay-shadow ui-body-a ui-corner-all'><h3>"+msg+"<&#47;h3><&#47;div>")
&#46;css({ display: "block",
opacity: 0&#46;90,
position: "fixed",
padding: "7px",
"text-align": "center",
width: "270px",
left: ($(window)&#46;width() - 284)&#47;2,
top: $(window)&#46;height()&#47;2 })
&#46;appendTo( $&#46;mobile&#46;pageContainer )&#46;delay( 1500 )
&#46;fadeOut( 400, function(){
$(this)&#46;remove();
});
}/preto show messages usepretoast("Message text");/pre
Sorry, but coding custom app logic is outside the scope of our support, so you would need to write validation code by yourself. Don't hesitate to ask if you have any specific question.

Ananya Raju
Posts: 0
Joined: Tue Oct 01, 2013 8:04 am

Form

it doesnt work ... i tried puting this code as customJS called the default name Javascript1
var toast = function(msg){
$(""+msg+"")
.css({ display: "block",
opacity: 0.90,
position: "fixed",
padding: "7px",
"text-align": "center",
width: "270px",
left: ($(window).width() - 284)/2,
top: $(window).height()/2 })
.appendTo( $.mobile.pageContainer ).delay( 1500 )
.fadeOut( 400, function(){
$(this).remove();
});
}

and onbutton click i am passing a javascript saying:
toast("Message text");

but still i aint getting the desired output

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Form

I updated the code. Please try with updated one.

Al Butler
Posts: 0
Joined: Wed Nov 27, 2013 7:22 pm

Form

works for me

Al Butler
Posts: 0
Joined: Wed Nov 27, 2013 7:22 pm

Form

my bad. The HTML got cleaned out when I pasted
Sorry

Return to “Issues”