Jump to content

some help needed


skendo

Recommended Posts

You can easily do it with javascripting..

 

<script type="text/javascript">
function dis_ena_submit()
{
if(document.acc_ctrl.add_access.options[0].selected ¦¦ document.acc_ctrl.add_assoc.options[0].selected)
{
//Disables submit button
document.forms[0].grant_button.disabled=true;
}
else
{
//Enables submit button
document.forms[0].grant_button.disabled=false;
}
}
</script>

Link to comment
https://forums.phpfreaks.com/topic/243963-some-help-needed/#findComment-1252691
Share on other sites

try this one and modify the following code according to your form fields name and the like because enable and disabling functionality is a good approach through javascripting

 

<script type="text/javascript">

{

  if (...) // some logic to determine if it is ok to go

    {document.getElementById("xx").disabled = false;}

  else // in case it was enabled and the user changed their mind

    {document.getElementById("xx").disabled = true;}

}

</script>

...

<input type="button" id="xx" disabled ...>

Link to comment
https://forums.phpfreaks.com/topic/243963-some-help-needed/#findComment-1252697
Share on other sites

  Quote

try this one and modify the following code according to your form fields name and the like because enable and disabling functionality is a good approach through javascripting

 

Yeah, because users totally can't just disable javascript or change the enable/disable flag or similar.  OP, do not do something like this.  Or at least, make sure you also output a message explaining that the user cannot submit unless they reach 5.  And also do NOT just blindly process the form submit by virtue of it being submitted.  If you output a disabled button and then assume that the amount is at least 5 by virtue of the user being able to submit (button not disabled), the user can easily alter the client-side html/javascript to enable it and submit! 

Link to comment
https://forums.phpfreaks.com/topic/243963-some-help-needed/#findComment-1252704
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.