Page 1 of 2

Form

Posted: Tue Dec 03, 2013 5:35 pm
by Ananya Raju

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 ...


Form

Posted: Tue Dec 03, 2013 6:18 pm
by Kateryna Grynko

Hi Ananya,

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


Form

Posted: Wed Dec 04, 2013 2:42 am
by Ananya Raju

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


Form

Posted: Wed Dec 04, 2013 7:06 am
by Maryna Brodina

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


Form

Posted: Wed Dec 04, 2013 8:13 am
by Ananya Raju

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


Form

Posted: Wed Dec 04, 2013 9:36 am
by Maryna Brodina

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.


Form

Posted: Wed Dec 04, 2013 12:04 pm
by Ananya Raju

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


Form

Posted: Wed Dec 04, 2013 12:46 pm
by Maryna Brodina

I updated the code. Please try with updated one.


Form

Posted: Tue Feb 04, 2014 6:23 pm
by Al Butler

works for me


Form

Posted: Tue Feb 04, 2014 6:32 pm
by Al Butler

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