Jump to content

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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